Loading a Widget from a different Widget or Gadget

Loading a Widget from a different Widget or Gadget

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
super_g
Posts: 13
Joined: 12 Jan 2012, 04:10

Loading a Widget from a different Widget or Gadget

Post by super_g »

Is there a Spring command that will load/initialize a widget?

I am looking for the something like the widgetHandler:RemoveWidget(), but with the flexibility to add and initialize any widget (by name or id), once a gadget detects a specific event.

Thanks
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Loading a Widget from a different Widget or Gadget

Post by SirMaverick »

super_g wrote:Is there a Spring command that will load/initialize a widget?
Spring doesn't know about widget/gadgets. They are purely implemented inside the Lua environment.
I am looking for the something like the widgetHandler:RemoveWidget(), but with the flexibility to add and initialize any widget (by name or id), once a gadget detects a specific event.
You might need to override the widget/gadget handler. Take a look at ZK, it implements it's own F11 list.
super_g
Posts: 13
Joined: 12 Jan 2012, 04:10

Re: Loading a Widget from a different Widget or Gadget

Post by super_g »

I found an easy was to enable or disable widgets using the following Spring Commands:

Spring.SendCommands({"luaui enablewidget <widgetName>"})
Spring.SendCommands({"luaui disablewidget <widgetName>"})
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Loading a Widget from a different Widget or Gadget

Post by zerver »

Yes. Spring still does not know about the widgets though. These commands are sent to the lua environment and the magic happens there.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Loading a Widget from a different Widget or Gadget

Post by zwzsg »

Most often, users want a pragmatic answer. Your stringent technicalities may be exact from a rigorous point of view, but are irrelevant here.
Post Reply

Return to “Engine”