Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-03

Re: MSEide + MSEgui -> FPC Wiki

11 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho
to Ales Katona
Ales Katona wrote
Looks like a pretty cool widgetset for lazarus to me...

I also think so. It probably isn´t hard to add a LCL widgetset for it. If anyone is interrested, I can help.

Felipe Monteiro de Carvalho

Reply by email

Den Jean

Hi,

would the FPC team mind if we'd use the FPC Wiki to document the use of the MSEGui library and the Ide ?

It is completely written in pascal, voiding the need to endlessly update bindings to gtk/qt etc :-)

kind regards,

Den Jean

Reply by email

Amir Aavani
to Ales Katona: Looks like a pretty cool widgetset for lazarus to me...

I have problem with procedure Types.
Look at the following code:

  TProcedure= procedure (S: String);
  TTest= class
    MyF: TProcedure;
     procedure F1 (S: String);
    procedure F2 (S: String);
    ....
    ...
  end;
TTest.constructor ;
begin
  MyF:= @F1;
end;

it says it can't cast "Procedure (S: String); Object" to TProcedure. The problem is clear but I don't know
(can't find) any solution to define TProcedure as a procedure of a class which accepts one argument.

Yours
Amir

Reply by email

Christian Iversen
to Amir Aavani
Amir Aavani wrote 21 lines
I have problem with procedure Types. Look at the following code: TProcedure= procedure (S: String); TTest= class MyF: TProcedure; procedure F1 (S: String); procedure F2 (S: String); .... ... end; TTest.constructor ; begin MyF:= @F1; end; it says it can't cast "Procedure (S: String); Object" to TProcedure. The problem is clear but I don't know (can't find) any solution to define TProcedure as a procedure of a class which accepts one argument.

You have declared MyF as a TProcedure, so this is just not going to work.

Try this instead:

type
  TMyFProc = Procedure(S: String) of Object;

...

  MyF: TMyFProc;

...

that should work.

Regards, Christian Iversen

Reply by email

Michael Van Canneyt
to Amir Aavani: I have problem with procedure Types. Look at the following code: TProcedure= procedure…
Amir Aavani wrote 23 lines
I have problem with procedure Types. Look at the following code: TProcedure= procedure (S: String); TTest= class MyF: TProcedure; procedure F1 (S: String); procedure F2 (S: String); .... ... end; TTest.constructor ; begin MyF:= @F1; end; it says it can't cast "Procedure (S: String); Object" to TProcedure. The problem is clear but I don't know (can't find) any solution to define TProcedure as a procedure of a class which accepts one argument.

Try the following (note the 'of object' in the declaration):

Type
  TMyStringProc = procedure (S : String) of object;

and then

  MyF : TMyStringProc;

This is documented.

Michael.

Reply by email

Amir Aavani
to Michael Van Canneyt

Thanks to Michael and Christian.
It works correctly.
I think it could be usefull to put an example for this case in fpc docs.

Michael Van Canneyt wrote 45 lines
On Sat, 4 Mar 2006, Amir Aavani wrote: >I have problem with procedure Types. >Look at the following code: > >TProcedure= procedure (S: String); >TTest= class >MyF: TProcedure; >procedure F1 (S: String); >procedure F2 (S: String); >.... >... >end; > >TTest.constructor ; >begin > MyF:= @F1; >end; > >it says it can't cast "Procedure (S: String); Object" to TProcedure. The >problem is clear but I don't know >(can't find) any solution to define TProcedure as a procedure of a class which >accepts one argument. > > Try the following (note the 'of object' in the declaration): Type TMyStringProc = procedure (S : String) of object; and then MyF : TMyStringProc; This is documented. Michael. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Amir Aavani
to Michael Van Canneyt: Try the following (note the 'of object' in the declaration): Type TMyStringProc =…

Any idea to call:
BeginThread (@MyObject.F1, Pointer (S))

Michael Van Canneyt wrote 45 lines
On Sat, 4 Mar 2006, Amir Aavani wrote: >I have problem with procedure Types. >Look at the following code: > >TProcedure= procedure (S: String); >TTest= class >MyF: TProcedure; >procedure F1 (S: String); >procedure F2 (S: String); >.... >... >end; > >TTest.constructor ; >begin > MyF:= @F1; >end; > >it says it can't cast "Procedure (S: String); Object" to TProcedure. The >problem is clear but I don't know >(can't find) any solution to define TProcedure as a procedure of a class which >accepts one argument. > > Try the following (note the 'of object' in the declaration): Type TMyStringProc = procedure (S : String) of object; and then x MyF : TMyStringProc; This is documented. Michael. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Michael Van Canneyt
to Amir Aavani
Amir Aavani wrote
Any idea to call: BeginThread (@MyObject.F1, Pointer (S))

You can't do this. MyObject.F1 is a method, not a procedure.

You should do something like:

Function MyThreadProc(P : Pointer) : Integer;
begin
   TMyObject(P).F1;
end;

and call

BeginThread (@MyThreadProc,(MyObject))

(don't remember the exact form of the thread function.)

Or better yet, use TThread.

Show quoted text 52 lines
Michael Van Canneyt wrote: > On Sat, 4 Mar 2006, Amir Aavani wrote: > > >> I have problem with procedure Types. >> Look at the following code: >> >> TProcedure= procedure (S: String); >> TTest= class >> MyF: TProcedure; >> procedure F1 (S: String); >> procedure F2 (S: String); >> .... >> ... >> end; >> >> TTest.constructor ; >> begin >> MyF:= @F1; >> end; >> >> it says it can't cast "Procedure (S: String); Object" to TProcedure. The >> problem is clear but I don't know >> (can't find) any solution to define TProcedure as a procedure of a class >> which >> accepts one argument. >> > > Try the following (note the 'of object' in the declaration): > > Type > TMyStringProc = procedure (S : String) of object; > > and then > x > MyF : TMyStringProc; > > This is documented. > > Michael. > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Geno Roupsky
to Amir Aavani: Any idea to call: BeginThread (@MyObject.F1, Pointer (S))

You could use this:

[snip]
type
  TObjThreadFunc = function: PtrInt of object;
function BeginObjThread(ThreadFunction: TObjThreadFunc): DWord;
begin
  with TMethod(ThreadFunction) do
    Result := BeginThread(TThreadFunc(Code), Data);
end;
[/snip]

2006/3/13, Amir Aavani :

Show quoted text 57 lines
Any idea to call: BeginThread (@MyObject.F1, Pointer (S)) Michael Van Canneyt wrote: >On Sat, 4 Mar 2006, Amir Aavani wrote: > > > >>I have problem with procedure Types. >>Look at the following code: >> >>TProcedure= procedure (S: String); >>TTest= class >>MyF: TProcedure; >>procedure F1 (S: String); >>procedure F2 (S: String); >>.... >>... >>end; >> >>TTest.constructor ; >>begin >> MyF:= @F1; >>end; >> >>it says it can't cast "Procedure (S: String); Object" to TProcedure. The >>problem is clear but I don't know >>(can't find) any solution to define TProcedure as a procedure of a class which >>accepts one argument. >> >> > >Try the following (note the 'of object' in the declaration): > >Type > TMyStringProc = procedure (S : String) of object; > >and then >x > MyF : TMyStringProc; > >This is documented. > >Michael. >_______________________________________________ >fpc-devel maillist - >http://lists.freepascal.org/mailman/listinfo/fpc-devel > > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel
Geno Roupsky

Reply by email