Hi,
I have a worker thread that calculates a crc values of a file. My
application maintains a maximum of 10 such threads at a time (though
the user can adjust the maximum value). Each thread is represented by
a progress bar on the main form of the application.
Under Delphi my worker thread could post a message using (PostMessage)
to notify the main form about the progress of the worker thread and
the max value the progress bar should be set at when starting.
How do I manage this under Lazarus. Note the application must be able
to run under Linux and Windows (where before it was only Delphi /
Windows).
The Object Pascal language, as implemented by Free Pascal understands
the 'message' declaration in a class, but how do I use it in a
cross-platform way? How do I send such custom messages?
For example;
----------------------------------------
interface
uses
...
LMessages;
const
UM_PROGRESS = WM_USER + 1;
UM_SETTEXT = WM_USER + 2;
UM_SETMAX = WM_USER + 3;
type
TMainForm = class(TForm)
[....]
protected
procedure UMProgress(var Message: TMessage); message UM_PROGRESS;
procedure UMSetText(var Message: TWMSetText); message UM_SETTEXT;
procedure UMSetMax(var Message: TMessage); message UM_SETMAX;
[....]
----------------------------------------
And this is how I used to send messages from the worker threads. This
example notified the main form what the progressbar's max value must
be set at - for the associated thread.
PostMessage(FHandle, UM_SetMax, integer(pointer(FProgressBar)),
FMaxValue);
I'm currently developing under Linux with GTK1 widget set. Trying to
compile this, Lazarus tells me in doesn't know PostMessage.
--
Graeme Geldenhuys
There's no place like S34° 03.168' E018° 49.342'
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives