IonicWind Software

Creative Basic => General Questions => Topic started by: GWS on January 30, 2015, 12:11:35 PM

Title: Inserting a Menu Separator
Post by: GWS on January 30, 2015, 12:11:35 PM
Hi,

A question was asked on Coding Monkeys as to how to insert a menu separator bar in a menu ..

To insert a separator when you write your Insertmenu statement, just insert a minus sign in the string ..


"I,-,0,0"


Here's an example program:


' Window Example 1
'
def w:window
def textWidth, textHeight, run : int
def a$ : string

autodefine "off"

window w,0,0,600,450,0,0,"Example 1",messages
setwindowcolor w, rgb(60,130,90)
centerwindow w

control w, "B, Exit, (600 - 60) / 2, 350, 60, 30, 0, 1"
setcontrolcolor w,1,0,rgb(0,150,200)

'  menu ..
menu w,"T,File,0,0","I,Open,0,1","I,Close,0,2","I,-1,0,0","I,Exit,0,100"

setfont w,"Times",25,600,@SFITALIC
frontpen w, RGB(210,210,210):' light grey

a$ = "Welcome to Creative Basic"
gettextsize w, a$, textWidth, textHeight
move w,(600 - textwidth) / 2,150
print w,a$

run = 1
waituntil run = 0
closewindow w
end

sub messages
select @CLASS
case @IDCLOSEWINDOW
' closing the window
run = 0
case @IDCHAR
' ESC(ape) key pressed will close the program ...
key = @CODE
if key = 27 then run = 0
case @IDCONTROL
select @CONTROLID
' Exit button ID 1 clicked ...
case 1
run = 0
endselect
case @idmenupick
select @menunum
case 100
run = 0
endselect
endselect
return


Best wishes, :)

Graham


Title: Re: Inserting a Menu Separator
Post by: Egil on January 30, 2015, 02:12:23 PM
I really believed I knew most CB secrets....
But this one was new to me!

Thanks for sharing Graham!