April 19, 2024, 03:28:13 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Bleed thru in Group Box

Started by billhsln, May 07, 2009, 09:55:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

I am displaying a small group box on my screen, however it seems that I am getting bleed thru from the prior information on the screen.  Does any one have an idea of what I can do to set this up so it will not have info from the prior screen?

OPENWINDOW w1,0,0,640,480,0,0,"Create POS files",&hnd

SUB hnd
'======
    'handler for the window w1
    SELECT @CLASS
        CASE @IDCREATE
            CENTERWINDOW w1
CONTROL w1,@GROUPBOX,"Store Selection",500,60,115,130,0x50000007,GROUP_1
CONTROL w1,@RADIOBUTTON,"7th",540,90,50,20,@TABSTOP|@GROUP,BUTTON_1
CONTROL w1,@RADIOBUTTON,"I45",540,120,50,22,@TABSTOP,BUTTON_2
CONTROL w1,@RADIOBUTTON,"I35",540,150,50,20,@TABSTOP,BUTTON_3
CONTROL w1,@SYSBUTTON,"Process Files",500,210,100,20,0x50000001,PROCESS
CONTROL w1,@SYSBUTTON,"Quit",500,250,40,20,0x50000001,QUIT
        CASE @IDCLOSEWINDOW
            CLOSEWINDOW w1


I have tried: RECT w1,0,0,640,480,cBlack,cBlack

and: SETWINDOWCOLOR w1, cBlack

neither or which seems to clear out the info in the group box. I have even tried both these commands before the CENTERWINDOW command.

Thanks,
Bill
When all else fails, get a bigger hammer.

LarryMc

This issue has been brought up several times; one or more times by me.

The groupbox wasn't designed for windows.  It's designed to work with dialogs.

Options:
1) switch from a window to a dialog
2) don't use groupbox but simulate it with line statements and a static text for the label.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Thanks, Larry.  I should have remembered that.  I had to do the drawing thing to get my Poker game to work right for the same reason.  Will set it up as a Dialog.

Thanks again,
Bill
When all else fails, get a bigger hammer.

Ionic Wind Support Team

Well....
There is a way to get it to look right, but you would need to subclass the group box control and either

#1.  Paint a background when you receive the WM_ERASEBKGRND message.
#2.  Create a custom region for the control to only encompass the lines and text label.

Simpler to just draw the lines yourself.

Paul.
Ionic Wind Support Team

billhsln

Paul, probably an excellent suggestion, but way way beyond my capabilities in EBasic.  I switched the program over to use a dialog box and it seems to be ok now, at least it works.

Only new question I have is how do I get a black background with cyan (light blue) text?  I tried SETWINDOWCOLOR w1, cBlack , but that is not giving me what I am looking for.

Also, after the Dialog is defined, I do:

SETFONT w1,"Courier New",12,400,0,0
SETWINDOWCOLOR w1, cBLACK
FRONTPEN w1, cCYAN
BACKPEN w1, cBLACK

Thanks,
Bill
When all else fails, get a bigger hammer.

GWS

This is an oldie ..  :)

The trick is to place a Text Box in the same place as the Group Box .. then all works fine ..

Here's a bit of old IBasic code .. but I imagine the same trick will work in EBasic ..  :P



def w1,w2:Window
def textW,textH:int

style = @SIZE|@MINBOX|@MAXBOX|@maximized
window w1,0,0,800,600,style,0,"IBasic Test",handler
setwindowcolor w1,rgb(0,100,100)
style = 0
window w2,0,0,350,150,style,0,"Small",handler2
setwindowcolor w2,rgb(200,2,2)
style = @CTEDITLEFT|@CTEDITMULTI|@HSCROLL|@VSCROLL
control w1,"E,,11,55,380,460,style,1"
control w1,"T,,6,20,450,500,0,2"
setcontrolcolor w1,2,0,rgb(0,100,100)
control w1,"C,Panel,6,20,450,500,0x50000007,3"
control w1,"B,Exit,(800-50)/2,540,50,25,0,5"

' set title text ..
title = "Group Box Transparency Test"
frontpen w1, RGB(0,0,0)
drawmode w1,@TRANSPARENT
SETFONT w1, "Times New Roman",40,700,@sfitalic
GETTEXTSIZE w1, title, textW, textH
move w1,(800-textW)/2,50
PRINT w1,title

waituntil w1 = 0
if w2 then closewindow w2

end

sub handler
SELECT @class
case @idclosewindow
closewindow w1
case @idcreate
centerwindow w1
case @idcontrol
SELECT @controlid
case 5
closewindow w1
ENDSELECT
ENDSELECT
return

sub handler2
SELECT @class
case @idclosewindow
closewindow w2
case @idcreate
centerwindow w2
ENDSELECT
return



best wishes, :)

Graham
Tomorrow may be too late ..

GWS

I hadn't tried that in EBasic - I've been re-building my machine ..  ::)

Anyway, I've tried it now and it seems to work OK.  Here's the code translated to EBasic ..


' test program for Groupbox with an associated Textbox

def w1,w2:Window
def textW,textH:int

style = @SIZE|@MINBOX|@MAXBOX
openwindow w1,0,0,800,600,style,0,"EBasic Test",&handler
setwindowcolor w1,rgb(0,100,100)
style = 0
' move the small window around to see the effects ..
openwindow w2,0,0,350,150,style,0,"Small",&handler2
setwindowcolor w2,rgb(200,2,2)
style = @CTEDITLEFT|@CTEDITMULTI|@HSCROLL|@VSCROLL
' covering an edit box with a groupbox is not a good idea - try typing in the edit box and then move
' the small window over it .. (you'll have to bring it back onscreen) ..
control w1,@edit,"",250,85,280,260,style,1
' notice that if the text box is commented out, the display corrupts if you move the small window ..
control w1,@static,"",6,90,450,400,0,2
setcontrolcolor w1,2,0,rgb(0,90,120)
control w1,@groupbox,"Panel",6,90,450,400,0x50000007,3
control w1,@button,"Exit",(800-50)/2,520,50,25,0,4

' set title text ..
title = "Group Box Transparency Test"
frontpen w1, RGB(0,0,0)
drawmode w1,@TRANSPARENT
SETFONT w1, "Times New Roman",40,700,@sfitalic
GETTEXTSIZE w1, title, textW, textH
move w1,(800-textW)/2,50
PRINT w1,title

waituntil w1 = 0
if w2>0 then closewindow w2

end

sub handler
SELECT @class
case @idclosewindow
closewindow w1
case @idcreate
centerwindow w1
case @idcontrol
SELECT @controlid
case 4
closewindow w1
ENDSELECT
ENDSELECT
return
endsub

sub handler2
SELECT @class
case @idclosewindow
closewindow w2
case @idcreate
centerwindow w2
ENDSELECT
return
endsub



all the best, :)

Graham
Tomorrow may be too late ..