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 <[email protected]> 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
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to