October 30, 2025, 04:27:15 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Graphics in a dialogue group box

Started by TGN, September 14, 2012, 12:47:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TGN

How can you display graphics in a dialogue group box  ???
like the CPU Usage History in Task Manager


Thanks
Torben

LarryMc

Well, just as a @GROUPBOX doesn't work correctly in a window (bleed-through) it also appears that in a dialog you can't stick a child window inside a groupbox(the window is over written)
The easiest thing that I could come up with was to create a child window and use the RECT command to draw my own groupbox box and I added a @STATIC text to the dialog for a groupbox title(it automatically overwrites and appears on top)
I then displayed my scaled image inside the child window allowing for spacing for the rect and the text.

I used GetSysColor to get the dialog color for the STATIC background and the color of the child window.

Now, there probably is a more sophisticated way to do it but this is the best i can do.

Hope this helps a little.
The zip contains the sorce code and the image to create the dialog displayed below.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

I decided to play with it some more.
This is a modified version (of the one above) which forces the window to the top of the dialogs Z-order.
It uses the @GROUPBOX control.
It's a little easier to set up.
It uses the image that is in the above zip.

DECLARE extern GetSysColor(nIndex:INT),INT
DECLARE extern SetWindowPos(hwnd:INT, hWndInsertAfter:INT, x:INT, y:INT, cx:INT, cy:INT, wFlags:INT),INT
CONST SWP_NOMOVE = 0x2
CONST SWP_NOSIZE = 0x1
const COLOR_3DFACE =15

DIALOG d1
WINDOW w1
uint backimage

'create main dialog and child windw
CREATEDIALOG d1,0,0,400,300,0x80CB0080,0,"my main dialog",&d1_handler
CONTROL d1,@BUTTON,"Button1",285,230,70,20,0x50000000,1
CONTROL d1,@groupbox,"Example",10,10,200,200,0x50000000,2
'load Jpg image
backimage = LOADIMAGE(GETSTARTPATH + "d28.jpg", @IMGSCALABLE)

showdialog d1

WAITUNTIL iswindowclosed(d1)

END

SUB w1_handler(),int
SELECT @MESSAGE
CASE @IDCLOSEWINDOW
closewindow w1
CASE @IDCREATE
setwindowcolor w1,GetSysColor(COLOR_3DFACE)
ENDSELECT
RETURN 0
ENDSUB

'__________________________________________________

SUB d1_handler(),int
int x, y, cx, cy
int wFlags=SWP_NOMOVE|SWP_NOSIZE

SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
OPENWINDOW w1,15,25,191,180,@nocaption,d1,"Simple child Window",&w1_handler
SetWindowPos(w1.hwnd, 0, x, y, cx, cy, wFlags)
SHOWIMAGE(w1,backimage,@IMGSCALABLE,0,0,191,180)
CASE @IDCLOSEWINDOW
deleteimage backimage,@IMGSCALABLE
CLOSEWINDOW w1
CLOSEDIALOG d1,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE 1
IF @NOTIFYCODE = 0
deleteimage backimage,@IMGSCALABLE
CLOSEWINDOW w1
CLOSEDIALOG d1,@IDOK
ENDIF
ENDSELECT
ENDSELECT
RETURN 0
ENDSUB



LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

TGN