Re: creating a widget inside an existing widget [message #67171] |
Fri, 10 July 2009 05:38  |
andersld
Messages: 4 Registered: February 2009
|
Junior Member |
|
|
I wanted to do something like this a while ago and came up with a
solution that may work for you. In the event handler, somehow get the
widget base ID of the base you'd like to add to, BaseID. Within the
event handler, do this:
1) Widget_Control, BaseID, Update = 0 ; makes things less jumpy
2) Create new widget base with all the buttons you want, and with the
parent BaseID
e.g.
subBase = Widget_Base(BaseID, column....)
buttonID = Widget_Button(subBase....)
3) Widget_Control, BaseID, Update = 1
If you are *replacing* one base with another, you'll need to destroy
the old base:
1.5) Widget_Control, subBase, /Destroy
Is this what you wanted?
-Loren
|
|
|
Re: creating a widget inside an existing widget [message #67173 is a reply to message #67171] |
Thu, 09 July 2009 22:18   |
b.a
Messages: 26 Registered: July 2009
|
Junior Member |
|
|
On Jul 10, 2:31 pm, David Fanning <n...@dfanning.com> wrote:
> b.a writes:
>> I am tying to add some code to my event handler program so that for
>> example each time "button1" is selected, a new widget-base inluding
>> some buttons and text is added to my existing widget. Can anybody
>> please help me how to do that? Is this at all possible?
>
>> In this way, each time "button1" is clicked and the new part is added
>> to the existing widget, it becomes bigger. Same as when we add a new
>> row to the bottom of a table; but this row has some buttons and text
>> inside it.
>
> You might get away with something like this on Windows,
> but I seriously doubt you will get away with it in UNIX.
> Typically, if you want to add widgets after you have
> realized the widget hierarchy, you must destroy and
> recreate the hierarchy. (There are keywords and techniques
> you can use to recreate it in the same location as the old
> hierarchy, etc., but basically, you have to rebuild it.)
>
> I'm only about 80% sure of this answer. Changes in the
> way widget events are handled, etc., may have changed things.
> Let's just say, I would be surprised if you got this to work.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks for your reply David.
Actually I am writing the program using IDL workbench. The only way
that I can think of is to have some widgets on my top level base which
are initially sensetive =0, and then I might be able to make them
sensetive=1 in case of the event. I may try it!!
Cheers
b.a
|
|
|
Re: creating a widget inside an existing widget [message #67174 is a reply to message #67173] |
Thu, 09 July 2009 21:31   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
b.a writes:
> I am tying to add some code to my event handler program so that for
> example each time "button1" is selected, a new widget-base inluding
> some buttons and text is added to my existing widget. Can anybody
> please help me how to do that? Is this at all possible?
>
> In this way, each time "button1" is clicked and the new part is added
> to the existing widget, it becomes bigger. Same as when we add a new
> row to the bottom of a table; but this row has some buttons and text
> inside it.
You might get away with something like this on Windows,
but I seriously doubt you will get away with it in UNIX.
Typically, if you want to add widgets after you have
realized the widget hierarchy, you must destroy and
recreate the hierarchy. (There are keywords and techniques
you can use to recreate it in the same location as the old
hierarchy, etc., but basically, you have to rebuild it.)
I'm only about 80% sure of this answer. Changes in the
way widget events are handled, etc., may have changed things.
Let's just say, I would be surprised if you got this to work.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: creating a widget inside an existing widget [message #67298 is a reply to message #67171] |
Sun, 12 July 2009 16:51  |
boshra afra
Messages: 2 Registered: July 2009
|
Junior Member |
|
|
On Jul 10, 10:38 pm, Loren <ander...@bu.edu> wrote:
> I wanted to do something like this a while ago and came up with a
> solution that may work for you. In the event handler, somehow get the
> widget base ID of the base you'd like to add to, BaseID. Within the
> event handler, do this:
>
> 1) Widget_Control, BaseID, Update = 0 ; makes things less jumpy
>
> 2) Create new widget base with all the buttons you want, and with the
> parent BaseID
> e.g.
> subBase = Widget_Base(BaseID, column....)
> buttonID = Widget_Button(subBase....)
>
> 3) Widget_Control, BaseID, Update = 1
>
> If you are *replacing* one base with another, you'll need to destroy
> the old base:
> 1.5) Widget_Control, subBase, /Destroy
>
> Is this what you wanted?
>
> -Loren
Hi Loren,
Thanks for your advice. I got it to work :)
Cheers
|
|
|
Re: creating a widget inside an existing widget [message #67320 is a reply to message #67173] |
Fri, 10 July 2009 06:08  |
Juggernaut
Messages: 83 Registered: June 2008
|
Member |
|
|
On Jul 10, 1:18 am, "b.a" <u4565...@anu.edu.au> wrote:
> On Jul 10, 2:31 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> b.a writes:
>>> I am tying to add some code to my event handler program so that for
>>> example each time "button1" is selected, a new widget-base inluding
>>> some buttons and text is added to my existing widget. Can anybody
>>> please help me how to do that? Is this at all possible?
>
>>> In this way, each time "button1" is clicked and the new part is added
>>> to the existing widget, it becomes bigger. Same as when we add a new
>>> row to the bottom of a table; but this row has some buttons and text
>>> inside it.
>
>> You might get away with something like this on Windows,
>> but I seriously doubt you will get away with it in UNIX.
>> Typically, if you want to add widgets after you have
>> realized the widget hierarchy, you must destroy and
>> recreate the hierarchy. (There are keywords and techniques
>> you can use to recreate it in the same location as the old
>> hierarchy, etc., but basically, you have to rebuild it.)
>
>> I'm only about 80% sure of this answer. Changes in the
>> way widget events are handled, etc., may have changed things.
>> Let's just say, I would be surprised if you got this to work.
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> Thanks for your reply David.
> Actually I am writing the program using IDL workbench. The only way
> that I can think of is to have some widgets on my top level base which
> are initially sensetive =0, and then I might be able to make them
> sensetive=1 in case of the event. I may try it!!
>
> Cheers
> b.a
If you're willing to allocate the space needed in your main widget for
all this business then MAP makes the widgets appear and reappear like
magic...not really magic though...
Sensitive also works if you just don't want someone to have the
ability to click the button.
|
|
|