How to set a background image for a window?
Code: Select all
RedrawWindow_(GadgetID(#YourImageGadget), 0, 0, #RDW_INVALIDATE)What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
Hi Sparkie
thanks that works on windows - not on linux. First my software goes out to windows and in a few months on linux. Maybe there is a chance to get it work on linux?
The ugly thing is: Without your grandios help the image (on the image) does not come up on start up but if i set a window from an other program over it and get it back to the foreground then it is displayed.
Thanks
Sigi
thanks that works on windows - not on linux. First my software goes out to windows and in a few months on linux. Maybe there is a chance to get it work on linux?
The ugly thing is: Without your grandios help the image (on the image) does not come up on start up but if i set a window from an other program over it and get it back to the foreground then it is displayed.
Thanks
Sigi
Will this work....
Code: Select all
ResizeGadget(#YourImageGadget, #PB_Ignore, #PB_Ignore, 0, 0)
ResizeGadget(#YourImageGadget, #PB_Ignore, #PB_Ignore, ImageWidth(#YourImage), ImageHeight(#YourImage))What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
Hi Sparkie
i have that problem with an other gadget too. It is a ListViewGadget() which i use for printing logging data on the screen. When i add items all goes fine until the scroll buttons should come up, then the border and the scroll buttons are hidden and sometimes the whole gadget goes hidden. If i set an other program window over the program then the gadget is visible until the next item is added.
With following code (like your help) after EVERY AddItem() it is shown all the times. Is that a bug or did i something wrong?
Sigi
i have that problem with an other gadget too. It is a ListViewGadget() which i use for printing logging data on the screen. When i add items all goes fine until the scroll buttons should come up, then the border and the scroll buttons are hidden and sometimes the whole gadget goes hidden. If i set an other program window over the program then the gadget is visible until the next item is added.
With following code (like your help) after EVERY AddItem() it is shown all the times. Is that a bug or did i something wrong?
Code: Select all
Width = GadgetWidth(#GUI_Logging)
Height = GadgetHeight(#GUI_Logging)
ResizeGadget(#GUI_Logging,#PB_Ignore,#PB_Ignore,0,0)
ResizeGadget(#GUI_Logging,#PB_Ignore,#PB_Ignore,Width,Height)
Gadgets on top of Gadgets is not the best approach here. I know you're looking for cross platform solutions but I think you're asking a bit much of PureBasic. I highly doubt the troubles you are having are being caused by a PB bug. 
I'd need to see some code to see what is happening on your side.
I'd need to see some code to see what is happening on your side.
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
Maybe i am working the wrong way. My program background is a image. The program has no border. My first way was to draw that picture to the window and then set the gadgets on the window. All works fine until a other program comes in foreground. After my program is back to foreground the background image is gone! So my second way was to use a imagegadget for the background. All times a other program is in foreground and my program comes back the image is always there. That is only why i have a gadget on a gadget.
I have searched in the list and found that other people had the same problems but i didn't found a solution. Maybe i searched wrong or had tomatoes on my eyes and you have a link or a tipp for me. ;)
I have searched in the list and found that other people had the same problems but i didn't found a solution. Maybe i searched wrong or had tomatoes on my eyes and you have a link or a tipp for me. ;)
Why not place the other gadgets inside the image gadget?
Code: Select all
UseGadgetList(GadgetID(#ImageGadget))I may look like a mule, but I'm not a complete ass.
Sparkie my projekt is very big with many sub program files which blows up all here if i post it because i must post all that you can compile that.
So i build a small part of what is going up like the following.
You can use any image you have for "test.bmp".
But don't cosh me - i don't get it "work" to disable the loaded background image in this sample!? Maybe it is because in the original there are a lot of gadgets? I don't know.
So i build a small part of what is going up like the following.
Code: Select all
CreateImage(1,300,300)
StartDrawing(ImageOutput(1))
DrawingMode(#PB_2DDrawing_Default)
Box(0,0,300,300,RGB(111,111,222))
StopDrawing()
LoadImage(2,"test.bmp")
StartDrawing(ImageOutput(1))
DrawImage(ImageID(2),0,0,300,300)
StopDrawing()
Flag = #PB_Window_ScreenCentered|#PB_Window_BorderLess
WindowHandler = OpenWindow(#PB_Any,0,0,300,300,"ImageGadgetTest",Flag)
If WindowHandler <> 0
If CreateGadgetList(WindowID(WindowHandler))
ImageGadget(3,0,0,300,300,ImageID(1))
DisableGadget(3,1)
ButtonGadget(4,10,10,280,20,"new item")
Flag = #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection
ListViewGadget(5,10,40,280,210,Flag)
ButtonGadget(6,10,270,280,20,"quit")
EndIf
EndIf
number = 1
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow : Break
Case #PB_Event_Gadget
Select EventGadget()
Case 4 : AddGadgetItem(5,-1," a new item - "+Str(number)) : number + 1
Case 6 : Break
EndSelect
EndSelect
ForEverBut don't cosh me - i don't get it "work" to disable the loaded background image in this sample!? Maybe it is because in the original there are a lot of gadgets? I don't know.
MyTrial, here's the code you posted adapted so that the 2 buttons and the listview are made child windows of the ImageGadget. This means that the gadgets are physically inside the image gadget.
The subclassed-procedure is required to pass command messages from the image gadget to the main window so that the event loop can trap the button clicks etc.
The subclassed-procedure is required to pass command messages from the image gadget to the main window so that the event loop can trap the button clicks etc.
Code: Select all
Global GoldImageProc, WindowHandler
Procedure ImageGadgetCallback(hWnd, uMsg, wParam, lParam)
Protected result
Select uMsg
Case #WM_COMMAND
SendMessage_(WindowID(WindowHandler), uMsg, wParam, lParam)
Default
result = CallWindowProc_(GoldImageProc, hWnd, uMsg, wParam, lParam)
EndSelect
EndProcedure
CreateImage(1,300,300)
StartDrawing(ImageOutput(1))
DrawingMode(#PB_2DDrawing_Default)
Box(0,0,300,300,RGB(111,111,222))
StopDrawing()
LoadImage(2,"test.bmp")
StartDrawing(ImageOutput(1))
DrawImage(ImageID(2),0,0,300,300)
StopDrawing()
Flag = #PB_Window_ScreenCentered|#PB_Window_BorderLess
WindowHandler = OpenWindow(#PB_Any,0,0,300,300,"ImageGadgetTest",Flag)
If WindowHandler <> 0
If CreateGadgetList(WindowID(WindowHandler))
ImageGadget(3,0,0,300,300,ImageID(1))
UseGadgetList(GadgetID(3))
ButtonGadget(4,10,10,280,20,"new item")
Flag = #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection
ListViewGadget(5,10,40,280,210,Flag)
ButtonGadget(6,10,270,280,20,"quit")
GoldImageProc = SetWindowLong_(GadgetID(3), #GWL_WNDPROC, @ImageGadgetCallback())
EndIf
EndIf
number = 1
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow : Break
Case #PB_Event_Gadget
Select EventGadget()
Case 4 : AddGadgetItem(5,-1," a new item - "+Str(number)) : number + 1
Case 6 : Break
EndSelect
EndSelect
ForEverI may look like a mule, but I'm not a complete ass.


