Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding menu items greys maximized Close(X) button

Status
Not open for further replies.

Greener73

Programmer
Jun 13, 2008
8
CA
Powerbuilder 9.03

When i run a small loop (5 iterations) and hide up to 5 menu
items using the .Hide() function it greys out any maximized windows close "X" button at the top right.

If i change this to .Visible = false this problem does not arise.

Is this a known bug?
 
Never heard of anything like this. (that's not to say it's not a bug)

For clarification... You have a window with a menu. Where are you looping from to hide/show enable/disable the menu items? From an event/function in the window/menu? And could you provide a snippet of the code used?
 
Thanks for the quick reply theklOwn

I call the function to determine if the menu items should be shown when the program is first ran.

Heres the code:
// check whether the menu entries should be visible
FOR count = 1 TO 5
IF cid[count] > 0 THEN
menuItems[count].Text = "test" + count
IF NOT menuItems[count].Visible THEN menuItems[count].Show()
ELSE
IF menuItems[count].Visible THEN
menuItems[count].Hide()
END IF
END IF
NEXT


Now if i change:
menuItems[count].Visible = false
it works fine

What really confuses me is I can throw a messagebox after that menuItems[count].Hide() and everything works fine. Heck, i can even put a break point in there in the debugger, and it works fine

Any ideas?
 
I'm assuming the above code isn't taken directly from the PB script? (the whole xxx.Text = "test" + count would have to be + String( count )) I'm guessing that cid[] is a boolean array? You're saying what was posted (using the .Show() & .Hide() functions) works? Try directly using the MenuItems properties for visibility and enabling. MenuItem.Visible = TRUE/FALSE... MenuItem.Enabled = TRUE/FALSE

Sounds similar to what happens when you first enter an infinite loop, only I typically get control regained enough to that window to click the "X" button and get the application shut down.
 
everything is the same, except that
menuItems[count].Text = "test" + count
is a bit longer. And you are right, it would need a (String) to make it compile.
cid is a long array of size 5


If i use the menuitem visible and enabled properties directly, everything works fine.

I have no problem doing this, I just get nervous that I might be overlooking a bigger problem, that is surfacing when i use Hide().

Do you think setting visible and enabled directly is an acceptable fix?

I should also note, that the Grey X is still clickable. It just turns colour. Besides the colour change, everything works like normal.
 
I personally never use Hide() or Show(), unless it's on a popup window. No real reason. But I do however use the Enabled and Visible properties constantly, and it's yet to bite me in the butt.
 
well i'll submit this as fixed and see what happens. I've spent far to long already on this simple problem.

Thank you very much for the help theklOwn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top