Page 1 of 1

PostPosted: Tue Sep 10, 2002 11:02 pm
by design4use
I have a UI gadget and want to turn it invisble from within the code of the form that the UiGadget is on. How do I do it?

Right now saying:
"gadget1.visible = false;" yields a 'not a member of this struct error.
Any ideas?

Your help is much appreciated,

PostPosted: Wed Sep 11, 2002 3:02 am
by dewey
A UIGadget has a visible property, but a the custom gadget does not. It looks like you are trying to set the visible property directly on the custom gadget.

Generally a gadget is defined something like this:
object CustomGadget {
UIGadget gadget;
// other members

To make the gadget invisible from a button handler:
handler mybutton.onselect() {
myform.myCustomGadget.gadget.visible = false;

PostPosted: Wed Sep 11, 2002 4:33 pm
by design4use
OK I assumed since my custom gadget is somehow derived from UiGadget it would also "listen" to UIGadgets visible property. Thanks for clarifying this!

After trying it out on screen, that seems to be working - partially.
I can see turning the visibility to false is trying to hide the gagdet, but there is are still parts of the gagdet visible. Should I add redraw() commands all over the place to clean up the on-screen "mess"? If so what do I apply the redraw commands to?
To add more info I have multiple gadgets on one form, some of which are overlapping. Depending on state changing a would like to turn one of them off while turning on another, so that there is one visible at a time. I always seem to be able to see pixels of all the gadgets.

I think some working example code with a form, two gadgets and a button to alternate their visbility would be a great helpful thing to add to the code examples section.

PostPosted: Wed Sep 11, 2002 5:15 pm
by design4use
It also seems to be true that when a gadget overlaps a form with say UIButtons on it, and the gadget gets turned invisible, the buttons below do not show up, even though they were visible before.
Is this also a matter of adding a bunch of redraws in the right places? (which ones?)

Again, thanks in advance to anybody who can help with these questions,

PostPosted: Wed Sep 11, 2002 9:19 pm
by dewey
Setting something to invisible does not repaint anything behind it. I <i>think</i> calling UIForm.redraw(0x8000) after hiding a gadget should do the trick.

PostPosted: Thu Sep 12, 2002 3:49 pm
by design4use
Here is what I did in my next attempt:
Have gadget overlapping a UIButton on a form named "mainForm" (this works)
I show the gadget, it overlaps the button (this works)
I hide the gagdet (this does not work , parts of the gadget still show), so I try to move the gagdet outside the screen (this works and the gadget is no longer visible)
However now, the space where there was previously a button is now blank, but I can still press that button (it show the selected appearance when I do) - this is the part where it does not work as expected.

PostPosted: Thu Sep 12, 2002 5:01 pm
by design4use
I then added
but that did not make a difference (the button still doesn't show up)

PostPosted: Wed Sep 18, 2002 3:50 pm
by design4use
OK here is what I am finding:
after endless combinations I find that
a) turning visibility off does not seem to always work, often gadgets still stay visible
b) after moving a gagdget that previously overlapped another gadget, the gadget below does not get redrawn, even if I call a method of the gadget that forces it to redraw. The overlap area stays white
c) mainForm.redraw(0x8000) does not appear to do anything when called (mainForm is the name of the form that I want to force to redraw)

I am happy to compile a minimal sample project if that would be of any help.

PostPosted: Mon Sep 23, 2002 3:47 am
by dewey
Can you send me your project in email, along with a description of exactly what I should do and see?

PostPosted: Mon Sep 23, 2002 5:35 pm
by design4use
Thanks Dewey:
I just sent you an email. I have enclosed a minimal project to demonstrate these issues:

1. object's visibility:
- when objects are turned invsible they still show when form.redraw(0x8000) is called afterwards
- when objects are turned invsible the objects underneath will not show up when form.redraw(0x8000) is NOT called afterwards

2. objects moving:
- when objects are moved the freshly revealed areas of the objects underneath are not shown regardless of whether or not form.redraw(0x8000) is called afterwards.

Thanks for looking into this!