paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] re: loadlayout


From: Andrew Ford
Subject: Re: [paragui-users] re: loadlayout
Date: Wed, 17 Apr 2002 10:42:33 -0700 (PDT)

I don't know the layout interface at all, but perhaps
something like:

hash_map< const std::string &, *(PARAGUI_CALLBACK()) >
staticCallbacks;
where the string is the name given to the particular
event of the widget defined in the layout.  Then you
could dynamically assign it with staticCallbacks[
EVENT_NAME ] = dynamicHandlerFunction;

That might be a good way to snap into a layout, with
each handler defaulting to a nullHandler() which did
nothing.  Of course, without knowing the layout
engine, I might be talking out of the pooper :)

Andrew.

--- Alexander Pipelka <address@hidden> wrote:
> Am Mit, 2002-04-17 um 16.45 schrieb Andrew Ford:
> > What about static proxy functions that pass the
> > message on to whatever dynamic function you want
> to
> > handle it?  
> > 
> > messageHandler( message )
> > {
> >   sendMessageToDynamicHandler( message, handler )
> > }
> > 
> > widget->SetEventCallback( messageHandler )
> 
> Good point :)
> 
> All that wrapped in a class combined with a map over
> librarynames and
> functionnames could provide a convenient way to snap
> in different
> function callbacks. (wow, really epic).
> 
> ;o)
> 
> Alex
> 
> 
> 
> > 
> > --- Alexander Pipelka <address@hidden>
> wrote:
> > > 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
> > > > 
> > > 
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > paragui-users mailing list
> > > address@hidden
> > >
> >
>
http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://taxes.yahoo.com/
> > 
> > _______________________________________________
> > paragui-users mailing list
> > address@hidden
> >
>
http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users
> > 
> 
> 
> 
> 
> _______________________________________________
> paragui-users mailing list
> address@hidden
>
http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]