For Programmers: Free Programming Magazines  


Home > Archive > Matlab > December 2005 > dynamic edit boxes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author dynamic edit boxes
Curtis Rands

2005-11-28, 7:07 pm

I'm trying to create a gui which both displays number values and
allows the values to be changed. By a toggle, the 'static text'
values should become 'edit text' boxes which the user can adjust. The
extra tricky part (to me) is that until the gui is opened, there are
not a predefined number of text boxes.

I'm having trouble with two things:
as I toggle back and forth from the static to the edit version, the
new objects just build right on top of the olds. I can't seem to get
the olds to delete like I want them to.

The 2nd problem: since there are not a predefined number of edit
boxes, I don't know how to handle dynamically creating the callbacks
that get the info from the edit box and store it; since I can't
create them all ahead of time using guide

I hope my question makes sense. Thanks for your help

Curtis
Michael Wild

2005-11-28, 7:07 pm

Hi

what I've found to be useful:

- create one callback, which determines from its caller object handle,
what to do with the updated value, and register it with all the edit
boxes. this way you don't need to have tons of nearly identical
callbacks. and this is the only way you can dynamically "create"
callbacks :-)

- don't delete the labels and edit boxes when you toggle. upon creation,
place them on two panels which have the same position. when you toggle
from one to the other, you just toggle the Visible property, and voilą.

hop this helps

- michael
Curtis Rands

2005-12-17, 7:05 pm

Michael Wild wrote:
>
>
> Hi
>
> what I've found to be useful:
>
> - create one callback, which determines from its caller object
> handle,
> what to do with the updated value, and register it with all the
> edit
> boxes. this way you don't need to have tons of nearly identical
> callbacks. and this is the only way you can dynamically "create"
> callbacks :-)
>
> - don't delete the labels and edit boxes when you toggle. upon
> creation,
> place them on two panels which have the same position. when you
> toggle
> from one to the other, you just toggle the Visible property, and
> voilą.
>
> hop this helps
>
> - michael
>

Curtis Rands

2005-12-17, 7:05 pm

Thanks Michael. It worked like a charm.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com