Page 1 of 1
"about box" image disappears. How to make modal?
Posted: Thu Jan 06, 2011 7:22 pm
by jassing
I have small about box with an image.
When this window is displayed it looks good; but if I click on the main app window, the about box looses focus; if I go back to the window -- the image is gone.
There is no code manipulating the image gadget.
why would the image disappear? the image is loaded from w/in the exe.
Is there a way to make the window modal? ie: the main screen cannot be acted upon, and the about box remains on top?
( I want to maintain os compatibility, so a "pure" purebasic solution is preferred over winapi's)
Re: "about box" image disappears. How to make modal?
Posted: Thu Jan 06, 2011 7:36 pm
by TomS
Just a guess, but check the ImageID. If you use the same ID in another window, they'll "steal" the image from one another.
Re: "about box" image disappears. How to make modal?
Posted: Thu Jan 06, 2011 7:39 pm
by jassing
TomS wrote:Just a guess, but check the ImageID. If you use the same ID in another window, they'll "steal" the image from one another.
It's the
only image...
I
had an imagebutton -- but the image would either show up incorrectly or not at all when disabled..
Re: "about box" image disappears. How to make modal?
Posted: Thu Jan 06, 2011 7:41 pm
by ts-soft
jassing wrote:Is there a way to make the window modal? ie: the main screen cannot be acted upon, and the about box remains on top?
( I want to maintain os compatibility, so a "pure" purebasic solution is preferred over winapi's)
Code: Select all
OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "")
CreateMenu(0, WindowID(0))
MenuTitle("?")
MenuItem(0, "About")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case 0
Break
Case 1
DisableWindow(0, #False)
CloseWindow(1)
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 0
OpenWindow(1, 0, 0, 400, 300, "About", #PB_Window_SystemMenu | #PB_Window_WindowCentered, WindowID(0))
DisableWindow(0, #True)
EndSelect
EndSelect
ForEver
For the first Question: Put the Image on a ImageGadget or paint the Image on #PB_Event_Repaint event.
Re: "about box" image disappears. How to make modal?
Posted: Thu Jan 06, 2011 7:49 pm
by TomS
ts-soft postet the solution to your question, but if you only want a modal window, because of the image disappearing, post some code and maybe we can help.
Re: "about box" image disappears. How to make modal?
Posted: Thu Jan 06, 2011 7:59 pm
by Trond
This is not supposed to happen. If you can reproduce this in a small snippet, post it here and we will help you. If you can't, you know for sure that the problem is somewhere in your big program.
Either you're reusing the same gadget number on different windows, or you have miscoded your event handling (maybe you made more than one event loop?).