Software Archive
Read-only legacy content

Tool bar icons

davidgraham
Beginner
452 Views
I have just added a new option to my Win 32 menu.
Now I find that when I use a tool bar buttons, the button disappears.
Is there any simple reason for this?

Thanks,
David
0 Kudos
7 Replies
Jugoslav_Dujic
Valued Contributor II
452 Views
Post more details please -- what do you mean "disappears"? Is "a tool bar buttons" intended to be plural or singular?
0 Kudos
davidgraham
Beginner
452 Views
Jugoslav,

When I click on one button, that one button disapears.

The problem is probably caused by my windows - I have one window (application frame window), rather than two windows (frame + one child occupying the frames client area, minus the area occupied by the tool bar). I tried to get this to work before but gave up as I couldn't get it to work. Now adding this one menu item has made the problem much worse. I think I will have to try again with the two windows - but I wanted to check there was not a simple cause of the problem.

Thanks,

David
0 Kudos
Jugoslav_Dujic
Valued Contributor II
452 Views
Do you have WS_CLIPCHILDREN .OR. WS_CLIPSIBLINGS in your frame window's style?
0 Kudos
davidgraham
Beginner
452 Views
Yes, it has WS_CLIPCHILDREN.
I am now rewriting the program so there are two Windows, a Frame and inside it, a Child window, both will have WS_CLIPCHILDREN.

Thanks,

David
0 Kudos
davidgraham
Beginner
452 Views
I 'solved' the problem by causing a redraw of the toolbar after using the button.
It is not perfect as it causes the screen to flash, but is better than disapearing buttons.
lret=ShowWindow(hWndToolBar,SW_HIDE)
lret=ShowWindow(hWndToolBar,SW_SHOW)
David
0 Kudos
Jugoslav_Dujic
Valued Contributor II
452 Views
Use InvalidateRect to obtain a flashless redraw (see neighbouring thread "Redrawing a dialog window"). Btw, did you try WS_CLIPSIBLINGS? That's supposed to force all child windows not to draw on each other's surface?
0 Kudos
davidgraham
Beginner
452 Views
Jugoslav,
I had WS_CLIPCHILDREN, adding WS_CLIPSIBLINGS made no difference.
Using InvalidateRec was no different to using ShowWindow - I still get a slight flash.

Tanks for your help, David
0 Kudos
Reply