"about box" image disappears. How to make modal?

Just starting out? Need help? Post your questions and find answers here.
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

"about box" image disappears. How to make modal?

Post 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)
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: "about box" image disappears. How to make modal?

Post 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.
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: "about box" image disappears. How to make modal?

Post 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..
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: "about box" image disappears. How to make modal?

Post 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.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: "about box" image disappears. How to make modal?

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: "about box" image disappears. How to make modal?

Post 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?).
Post Reply