[Lazarus] Doing work in FormActivate

2009-01-13 Thread Gabor Boros
Hi,

Sometimes I used OnActivate event in Delphi for do some work and e.g. 
show a progressbar to the user. But with Lazarus this thing not working.
Form showed up after the OnActivate finished. Is it bug 
http://bugs.freepascal.org/view.php?id=10654 . Can anybody have a good 
solution for this problem?

And and another question. Every time when the form activated the 
OnActivate event triggered, after switched to another app and switched 
back etc. I try to eliminate this by write if Active then Exit; to the 
OnActivate but in this case things after the if Activate... line never 
triggered.

Gabor

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Doing work in FormActivate

2009-01-13 Thread Gabor Boros
My main problem is the form not appears on the screen under OnActivate 
event. How can I make a progress form, display some informations, 
progress bars etc. and when the job finished the user can read the 
information and then close the form with a button?

Doug Chamberlin írta:
 For Windows the OnActivate event should fire every time the window is 
 re-activated as you describe. This is as designed. If you want to 
 process something only once when the window is first activated try the 
 OnShow event.
 
 If you must run some code only once but still within the OnActivate 
 handler, the best way I have found is to add a field to the TForm that 
 indicates the OnActivate has been run once. I usually use FActivated: 
 Boolean for this. Then in the OnActivate handler put:
 
 if not FActivated then begin
//Do some work here that should only happen once
FActivated := True;
end;

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Doing work in FormActivate

2009-01-13 Thread Gabor Boros
Hi,

A simple test case:

procedure TForm1.FormActivate(Sender: TObject);
begin
   Caption:=FormatDateTime('hh:mm:ss',Now);
end;

With Delphi the form's caption show the first activation time and with 
Lazarus the caption changed when switch to other application and switch 
back etc.. I don't say Delphi is correct but after working many years 
with Delphi this thing is strange for me.

Gabor


Doug Chamberlin írta:
 You have confused me here. What did you mean by this?
 
 As far as I can tell this is exactly how Delphi performs under Windows 
 and exactly how it should perform. What am I missing?

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] File encoding changing silently

2009-01-06 Thread Gabor Boros
Hi,

I am fighting with an ansi/unicode/utf8 problem and during this war 
observed a strange thing for me about file encoding.
When a new project created the encoding is CP1250 (from File 
Setting/Encoding ) for me. Then saved the project the encoding is CP1250 
in File Setting/Encoding. But when reopen the project (with or without 
close Lazarus) Encoding displays UTF8. Is it normal? Lazarus convert 
encoding automatically or new files created with UTF8 but File 
Setting/Encoding display wrong value?

Gabor

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] File encoding changing silently

2009-01-06 Thread Gabor Boros
I discovered next things. Created new project and encoding is UTF8. It 
is good. But set encoding to CP1250 and go into File Settings/Encoding 
no check appears before any item. But this problem showed only once.
Second problem. The files created with UTF8 now. Right. But if set 
Encoding to CP1250 (after pressed Change file) File Settings/Encoding 
displays good CP1250 value but if reopen the project the File 
Settings/Encoding displays UTF-8 again.

Gabor

Mattias Gärtner írta:
 Zitat von Gabor Boros gaborbo...@yahoo.com:
 
 I fixed one place in r18166. Please test.


___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] File encoding changing silently

2009-01-06 Thread Gabor Boros
Mattias Gärtner írta:
 Zitat von Gabor Boros gaborbo...@yahoo.com:
 
 Are you sure?
 Is there a menu item with a bracket?

No. ;-) Before, I said CP1250 but now I say Ansi(cp1250).
When click on Ansi(cp1250) and after go to Encoding again,
Ansi(cp1250) and no other encoding selected.

 BTW, why do you want to use CP1250 as encoding instead of UTF-8?

I don't want. Just playing with encoding setting after you fixed the 
problem.

Gabor

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How can I use TMemDataset

2009-01-05 Thread Gabor Boros
Provide an example for what? I don't understand you.

Gabor

Joost van der Sluis írta:
 I don't know how the Lazarus editor works, but for the rest, can you
 provide an example?

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How can I use TMemDataset

2009-01-05 Thread Gabor Boros
Under test case creation indentified the Append problem.
I used Edit; after Append; and when removed the Edit; the record 
inserted properly to the  DataSet. Below example works.
But if put the MemDataset to the form set name to DSet add a field with 
the object inspector set name to NAME, set type to ftString and size to 
20. Remove the first 2 lines after begin (.Create and .FieldDefs.Addd) 
the result (dset.txt) contains only the header. With dynamic creation 
the file contains the 2 records.

procedure DSet_Test;
var
   DSet:TMemDataset;

begin
   DSet:=TMemDataset.Create(Self);
   DSet.FieldDefs.Add('NAME',ftString,20);
   DSet.CreateTable;
   DSet.Open;

   DSet.Append;
   DSet.FieldByName('NAME').Value:='aaa';
   DSet.Post;

   DSet.Append;
   DSet.FieldByName('NAME').Value:='bbb';
   DSet.Post;

   DSet.SaveToFile('c:\dset.txt');

   DSet.Close;
end;

Gabor

Joost van der Sluis írta:
 Op maandag 05-01-2009 om 16:50 uur [tijdzone +0100], schreef Gabor
 Boros:
 Provide an example for what? I don't understand you.
 
 An example application which uses TMemDataset and apply/post/etc that does 
 not work.
 
 Joost.
 
 
 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
 

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] How can I use TMemDataset

2009-01-05 Thread Gabor Boros
Hi,

I want to use an in memory dataset and found TMemDataset.
But not working very well. If defined the fields in Object Incpector the 
  whole thing unusable. Appended records with AppendRecord or with 
Append/Edit/Post not inserted into dataset. If define fields at run-time 
with FieldDefs.Add Append/Edit/Post working but AppendRecord not and 
Append/Edit/Post is just working on first try. Tried with FPC 2.2.2 and 
actual Lazarus SVN.

Anybody using TMemDateset?

Gabor

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How can I use TMemDataset

2009-01-05 Thread Gabor Boros
The result is same with CreateTable and without CreateTable.

Gabor

Joost van der Sluis írta:
 My guess is that you also have to remove CreateTable? I'll look into it.
 
 Joost.

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Prevent focus losing

2008-08-25 Thread Gabor Boros
I tried your original problem now (earlier not) and TEdit don't loose focus.

TCustomButton have a TabStop property. But TSpeedButton not because 
derived from TGraphicControl.

Gabor

   This is workaround, thanks for suggestion.
 
   Another question: how is implemented focus grabbing in TCustomButton, 
 is there way to disable focus grabbing in TSpeedButton?
 

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Prevent focus losing

2008-08-24 Thread Gabor Boros
Hi,

Why not use CustomEdit1.SetFocus in CustomSpeedButton1.Click?

Gabor

 Hello,
 
   situation: I have TCustomEdit and TCustomSpeedButton; when focus is in 
 edit and I press speed button then edit loses focus.
   How to prevent losing focus when I press speed button?
 

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus