PDA

View Full Version : dynamic panels



djethernet
04-07-2008, 02:28 AM
I've been trying to achieve panels that can have controls changed dynamically. For example, the user picks item in a list box and then instantly the controls change to present sliders and other gadgets according to the choice. I've tried a plethora of ways. I couldn't find a method to "re-create" controls after presenting/creating the panel. (xpanel or panel) The closest I've gotten was to; Close the panel; Destroy it ; re-configure it and then re-open it again. While this seems to work, the callstack grows everytime a panel is closed, destroyed and reopened again, upon finally exiting the panel callbacks go crazy as they are registered all over the place, when it unrolls everything. I've tried this with blocked and non blocked panels. There has to be a way to do this I'm hoping.

BloodQuest
05-08-2008, 06:02 PM
The SDK lists a macro ERASE_CON( ctl ) and there's also the draw control:

draw( control, DR_ERASE )

But I can't get it to work, course it's probably just another new trick...

Simon

Lightwolf
05-08-2008, 06:08 PM
Erasing and drawing should work without closing and open a LWPanel, but probably requires you to trigger a refresh and then redraw the controls during the refresh.

Since you have a list you need a LWPanel for that anyhow, but you can embed an XPanel into that for options related to the selected item (the node editor uses a similar method to embed XPanel GUIs on the right hand side). The contents of the XPanel control (which, as far as LWPanels is concerned, is just a control with a size) can be changed... and a refresh of the LWPanel will then show the new contents.

Cheers,
Mike

BloodQuest
05-08-2008, 06:38 PM
Bizarre! I had posted a correction or I thought I had, but it seems to have disappeared into the aether...

The following seems to work:

LWControl *pctl;

pctl = ctl[ 1 ];

ERASE_CON( pctl );

Mike, you're a genius - any idea where I'm going wrong in my thread http://www.newtek.com/forums/showthread.php?t=83892

Cheers,

Simon

djethernet
09-09-2008, 03:39 AM
Thanks guys, when i get back to that tool I'll try it out!