quarta-feira, 26 de agosto de 2009

The component LazGradient

With this component the programs written in lazarus are with an appearance well attractive, but well-taken care of to not to exaggerate.

Examples:





Main properties:

BeginColor:TColor
EndColor:TColor
Orientation => foLeftToRight, fdTopToBottom
Rounded => Boolean

In the current version this component to the being added in form, automatically occupies all the screen.

To correct, it makes the alterations to follow.
Open the package Lazgradient.lpk
Open unit Gradient.pas and locates the code below:

constructor TLazGradient.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
BeginColor:= clBlue;
EndColor:= clWhite;
Orientation:= foLeftToRight;
Align:= alClient;
Alignment := taCenter;
Rounded:= False;
end;

Change

Align:= alClient;

to

Align:= alNone;

It adds the lines below:

Height:=35;
Width:=120;

Result below:

constructor TLazGradient.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
BeginColor:= clBlue;
EndColor:= clWhite;
Orientation:= foLeftToRight;
Align:= alNone;
Alignment := taCenter;
Rounded:= False;
Height:=35;
Width:=120;
end;

It develops its system of commercial automation.
Try the LazGradient!

Link to download component:

http://wile64.perso.neuf.fr/download/lazarus/lazgradient.zip

Until the next one.

segunda-feira, 17 de agosto de 2009

Running lazarus under wine

Running lazarus under wine

For that they develop for linux and windows and the use of one virtual machine is not an alternative practises, and it has time to try wine, then this tip can be interesting.

Really run an application in wine can not be the option most trustworthy, but in many cases decided the problem to have that to work simultaneously with two OS, what implies the use of virtual machines, that they consume much processing of cpu, but each one has an opinion and depends on each case.

Make lazarus run on wine

Many times when I installed lazarus in wine, he was not possible to work, therefore he did not obtain to open the projects.
Example:

project g:\diversos\laztestewin32\linux\rlreportteste.lpi

When trying to open, lazarus returns that the project does not exist:



E thus occurs pra any archive that to try to open.
The first solution that came me the mind was to create one link symbolic pointing pra required folder, thus:
Considering:
G: =/home/teste
cd /home/teste/diversos/laztestewin32/
ln - s linux/linu

… and ready, it decided.
The problem is that when opening the same archive, lazarus suppressed finishes it letter another time, and thus successively, and had that to create new link.
I decided for the hand in the mass and to study the code.

Then I created following the functions:

Please, sees the unit mainwine.pas below listed

I observed that the problem happens whenever the class TOpenDialog and TSaveDialog is used.
Unit that this the code to save the projects, packages, etc is main.pp.
Then, is alone to include this unit (mainwine) in the uses clause of unit main.pp and to call these functions before opening and saving its archives in IDE.

It creates a directive USEWINE:
{$DEFINE USEWINE}

Now it implements in the cases below:


procedure TMainIDE.mnuOpenClicked(Sender: TObject);

...
For I := 0 to OpenDialog.Files.Count-1 do
Begin
AFilename:=CleanAndExpandFilename(OpenDialog.Files.Strings[i]);
{$IFDEF USEWINE}
AFilename:=mainwine.WineValidFile(AFilename);
{$ENDIF}
...

function TMainIDE.DoShowSaveFileAsDialog(AnUnitInfo: TUnitInfo;
var ResourceCode: TCodeBuffer): TModalResult;
...
NewFilename:=ExpandFileNameUTF8(SaveDialog.Filename);
{$IFDEF USEWINE}
NewFilename:=WineValidSaveFile(NewFilename);
{$ENDIF}
...

if ExtractFileExt(NewFilename)='' then begin
NewFilename:=NewFilename+SaveAsFileExt;
{$IFDEF USEWINE}
NewFilename:=WineValidSaveFile(NewFilename);
{$ENDIF}
end;
...
{$IFDEF USEWINE}
NewFilename:=WineValidSaveFile(NewFilename);
{$ENDIF}
NewFilePath:=ExtractFilePath(NewFilename);
...

function TMainIDE.DoShowSaveProjectAsDialog: TModalResult;

...
NewFilename:=ExpandFileNameUTF8(SaveDialog.Filename);
{$IFDEF USEWINE}
NewFilename:=WineValidSaveFile(NewFilename);
{$ENDIF}
if not FilenameIsAbsolute(NewFilename) then
RaiseException('TMainIDE.DoShowSaveProjectAsDialog: buggy ExpandFileNameUTF8');
NewProgramName:=ExtractFileNameOnly(NewFilename);
...

I did not test all the cases, therefore for me of this skill he decided great part of the problem, and the code of IDE is very complex, and extensive.
But a solution for the problem, and those developers is registered that collaborate with the project and have more affinity with the code of unit main.pp and others units that they make the IDE, can appreciate and it will be the case, to implement definitively, and thus to offer to end user a new alternative.

Until the next one.

unit mainwine;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils;

function WineValidFile(filename1:string):string;
function WineValidSaveFile(filename1:string):string;

implementation

function WineValidFile(filename1:string):string;
var
wineFile,wineFile2,winePath,winePath2:string;
wineListChar:TStringlist;
pathLen,charCount:integer;
begin
wineListChar:=TStringlist.Create;
Result:=filename1;
if not SysUtils.FileExists(filename1) then
begin
WinePath:=SysUtils.ExtractFilePath(filename1);
PathLen:=length(WinePath);
WinePath:=copy(WinePath,1,PathLen-1);
wineFile:=SysUtils.ExtractFileName(filename1);
for charCount:=32 to 127 do begin
wineFile2:=WinePath+chr(charCount)+'\'+wineFile;
if fileexists(wineFile2) then begin
Result:=wineFile2;
break;
end;
end;
end;

end;

function WineValidSaveFile(filename1:string):string;
var
wineFile,wineFile2,winePath,winePath2:string;
wineListChar:TStringlist;
pathLen,charCount:integer;
begin
wineListChar:=TStringlist.Create;
Result:=filename1;
if not SysUtils.FileExists(filename1) then
begin
WinePath:=SysUtils.ExtractFilePath(filename1);
PathLen:=length(WinePath);
WinePath:=copy(WinePath,1,PathLen-1);
wineFile:=SysUtils.ExtractFileName(filename1);
for charCount:=32 to 127 do begin
wineFile2:=WinePath+chr(charCount)+'\'+wineFile;
if DirectoryExists(WinePath+chr(charCount)+'\') then
begin

Result:=wineFile2;
break;
end;
end;
end;

end;

end.

sábado, 15 de agosto de 2009

Configuring screen font multiplatform

Configuring screen font multiplatform

Who develops applications multiplatforms, many times has the problem of appearance generated for the screen font, that always finishes annoying. I decided this problem manually defining the font that would be used in linux, and another font in windows, thus:
{$IFDEF LINUX}
self.font.name: =' Helvetica' ;
{$ENDIF}
Thus, in linux ' used font; Helvetica' e in windows font ' Ms Sans Serif'. Of course he was not perfect, therefore the sizes are different.
This when I used kylix3.
But now, with lazarus and widget QT, I obtained the solution this problem of satisfactory form. Of them you vary fonts that I tested, I discovered that font Verdana has accurately the same resulted visual, as much in windows as in linux, to worry thus not necessary me in being change labels width, to fit the text in both the operational systems.
Therefore, before drawing any visual component in form, I changed font to Verdana. He is not font prettier, but it did not give to continue of the skill that was, therefore to configure one font for windows and another one for linux is complicated.

Also standard of applications QT in the QTConfig is possible to configure font, but I do not advise to make this.
This procedure was tested only in linux (not use widget QT in windows)
If somebody already decided this problem in another way, accepted you criticize and suggestions. In next post, I will show as I decided the problem to inside execute lazarus under wine, correcting that one bug of the directory, that it hinders to open the projects under wine.
Until the next one.

terça-feira, 4 de agosto de 2009

Lazarus - para desenvolvedores Delphi

Lazarus é uma ferramenta de desenvolvimento rápido de aplicações (RAD) semelhante ao Delphi da Embarcadero.
Assim como o Delphi, contém uma biblioteca de componentes visuais e uma IDE. A biblioteca de componentes do Lazarus (LCL) é muito parecida com a do Delphi que é a VCL. Muitas unidades, classes e propriedades tem o mesmo nome e funcionalidade. Assim, converter programas do Delphi pro lazarus é relativamente fácil.

Mas não espere 100% de compatibilidade com o Delphi. O Lazarus não é um clone do Delphi', apenas compativel.

Apresentando o Lazarus

Tela principal:



O Editor de codigo:



Paleta de Componentes

Standart:



Componentes: TMainMenu,TPopUpMenu,TButton,TLabel,TEdit,TMemo,TTogglebox,TCheckBox,TRadioButton,TListBox,TComboBox,TScrollBar,TGroupBox,TRadioGroup,TCheckGroup,TPanel,TFrame,TActionList

Additional



Componentes:
TBitBtn,TSpeedButton,TStaticText,TImage,TShape,TBevel,TPaintBox,TNotebook,TLabeledEdit,TSplitter,TTrayicon,TMaskEdit,TCheckListBox,TScrollBox,TApplicationProperties,TStringGrid,TDrawGrid,TPairSplitter,TColoBox,TColorListBox,TChart

Paleta Common Controls:



Componentes:
TTrackBar,TProgressBar,TTreeview,TListView,TStatusBar,TToolBar,TUpDown,TPageControl,TTabControl,THeaderConrol,TImagelist,TPopupNotifier

Paleta Dialogs:



Componentes:
TOpenDialog,TSaveDialog,TSelectDirectoryDialog,TColorDialog,TFontDialog,TFindDialog,TReplaceDialog,TOpenPictureDialog,TSavePictureDialog,TCalendarDialog,TCalculatorDialog,TPrintSetup,TPrintDialog,TPageSetupDialog

Paleta Misc:



Componentes:
TColorButton,TSpinEdit,TFloatSpinEdit,TArrow,TCalendar,TEditButton,TFileNameEdit,TDirectoryEdit,TDateEdit,TCalcEdit,TFileListBox,TFilterComboBox,TXMLPropStorage,TIniPropStorage,TBarChart,TButtonPanel,TShellTreeView,TShellListView,TIDEDialogLayoutStorage

segunda-feira, 3 de agosto de 2009

Fortes Report for Lazarus on sourceforge.net

Fortes Report for Lazarus on sourceforge.net

The project FortesReport4Lazarus is now avaliable in sourceforge.net at the address

http://fortes4lazarus.sourceforge.net/

FortesReport4Lazarus need contributors.
Join to the project and help to make the FortesReport4Lazarus the best report generator to lazarus freepascal.

regards