[Lazarus] Putting class method names in a stringlist
kapibara
kapibara.pas at aol.com
Fri Jan 23 04:33:32 CET 2015
Wow! Thank you very much, Mattias !
On 2015-01-20 10:26, Mattias Gaertner wrote:
> On Tue, 20 Jan 2015 01:46:52 +0100
> kapibara <kapibara.pas at aol.com> wrote:
>
>> I have been trying for some days to create a combobox with names of
>> event handlers. The handlers are many and resides in its own class. I
>> cant find out how to get the names of the methods into the combobox,
>> except hardcoding them. Do I really have to add manually the names of
>> the class methods?
>>
>> Below: assigning the handler, by selecting from the combobox.
>>
>> EventHandlerName:= MyComboBox.Items[MyComboBox.ItemIndex];
>> MyObject.OnEvent:= MyEventHandlers.MethodAddress(EventHandlerName);
> 1. Make the methods "published".
> 2.
>
> ti := obj.ClassInfo;
> PropCnt := GetPropList(ti, propList);
> try
> for i := 0 to PropCnt - 1 do begin
> if propList^[i]^.PropType^.Kind<>tkMethod then continue;
> writeln('methodname: ',propList^[i]^.PropType^.Name);
> end;
> finally
> FreeMem(propList);
> end;
>
> Mattias
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
More information about the Lazarus
mailing list