[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [paragui-users] re: loadlayout
From: |
Alexander Pipelka |
Subject: |
Re: [paragui-users] re: loadlayout |
Date: |
17 Apr 2002 16:41:41 +0200 |
Am Mit, 2002-04-17 um 16.15 schrieb Keith Swyer:
> thanks. is it possible have the actual functions loaded dynamically at
> runtime? this is most likley away from the
> scope of the current ParaGUI, but something I am interested in doing if not
> currently available. Reason being, i am looking at a program which has
> several similar areas, with more or less buttons than another, and would
> like to keep coding sizes minimal to reduce re-compiling and make it more
> expandable easier.
Well, that's beyond the scope currently.
A workaround would be to reconnect all callbacks after loading the
functions from a shared lib.
e.g.: You have 2 widgets (w1, w2) calling callback functions (c1,c2)
implemented differently in library1, library2.
dlopen(library1)
c1 = dlsym(library1, function1)
c2 = dlsym(library1, function2)
w1->SetEventCallback(..., c1);
w2->SetEventCallback(..., c2);
some time later you might do:
dlopen(library2)
c1 = dlsym(library2, function1)
c2 = dlsym(library2, function2)
w1->SetEventCallback(..., c1);
w2->SetEventCallback(..., c2);
Don't expect the code above to pass any compiler run :))
But beware! This can be dangerous.
Alex
>
> --Keith
>
> Am Mit, 2002-04-17 um 15.36 schrieb Keith Swyer:
> > hi, just wondering how to use the loadloayout function and connect a
> button
> > in the layout to a function.
>
> Quite easy :))
>
> - load your layout via LoadLayout()
>
> - get a pointer to the widget e.g.:
> PG_Widget* my_widget = PG_Application::GetWidgetByName("widgetname");
>
> - connect your widget to the callback
> my_widget->SetEventCallback(...)
> or
> my_widget->SetEventObject(...)
>
> That's it.
> Have fun.
>
> Alex
>
>
>
> @------------------------------------------------------------
> Keith Swyer
> Software Engineer
>
> www.adventus.com
> @-------------------------------------------------------------
>
>
> _______________________________________________
> paragui-users mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users
>