* *

Coding

Welcome, Guest. Please login or register.
Did you miss your activation email?
December 15, 2017, 05:08:11 AM

Login with username, password and session length

Menu

Members
Stats
  • Total Posts: 12183
  • Total Topics: 1737
  • Online Today: 41
  • Online Ever: 195
  • (February 11, 2014, 01:46:08 PM)
Users Online
Users: 0
Guests: 26
Total: 31
Yahoo!
Sogou
Google (2)
Baidu

Author Topic: Menu Separator?  (Read 3754 times)

0 Members and 1 Guest are viewing this topic.

Offline Pablo S

  • Newbie
  • *
  • Posts: 3
  • Bananas: 0
  • Gender: Male
  • I haven't set any personal text yet
Menu Separator?
« on: January 29, 2015, 10:38:41 PM »
How using MENU and INSERTMENU statements can I add a menu separator?

Regards,

- Pablo

Offline GWS

  • Moderator
  • Sr. Member
  • *****
  • Posts: 352
  • Bananas: 14
Re: Menu Separator?
« Reply #1 on: January 30, 2015, 01:23:48 PM »
Hi Pablo,

Nice to see someone using Creative Basic - still one of the best languages. :)

For a separator, when you write your Insertmenu statement, just insert a minus sign ..
Code: [Select]
"I,-,0,0" in the string as in ..

Code: [Select]
insertmenu win,1,"T,Preferences,0,0","I,Speed,0,1","I,Tone,0,2","I,-,0,0","I,Morse Format,0,3"

Best wishes, :)

Graham

« Last Edit: January 30, 2015, 01:24:29 PM by GWS »
Tomorrow may be too late ...

Offline Pablo S

  • Newbie
  • *
  • Posts: 3
  • Bananas: 0
  • Gender: Male
  • I haven't set any personal text yet
Re: Menu Separator?
« Reply #2 on: January 30, 2015, 05:43:04 PM »
Hello,

Thanks for the info!.

Also how can I add a hotkey or shortcuts like so: "&New\tCtrl+N"?

What I want is to add Ctrl+N after New in the menu. I am using Windows 8.0 .

Best regards,

- Pablo

Offline GWS

  • Moderator
  • Sr. Member
  • *****
  • Posts: 352
  • Bananas: 14
Re: Menu Separator?
« Reply #3 on: January 30, 2015, 10:37:04 PM »
Hi Pablo,

Probably best to use an auxiliary statement in order to keep the statement lines short, such as :

Code: [Select]
a$ = "I,Speed..." + chr$(9) + "Ctrl S" + ",0,1"
insertmenu win,1,"T,Preferences,0,0",a$,"I,Tone,0,2","I,-,0,0","I,Morse Format,0,3"

or in your example :

Code: [Select]
a$ = "I,New..." + chr$(9) + "Ctrl N" + ",0,1"
menu win,"T,File,0,0",a$,"I,Exit,0,100"

Just remember that all command statements are processed as strings of characters, and can be manipulated as you would any strings in Basic.  :)

Best wishes, :)

Graham
« Last Edit: January 31, 2015, 09:22:23 PM by GWS »
Tomorrow may be too late ...

Offline Pablo S

  • Newbie
  • *
  • Posts: 3
  • Bananas: 0
  • Gender: Male
  • I haven't set any personal text yet
Re: Menu Separator?
« Reply #4 on: January 31, 2015, 09:42:35 PM »
Hello Graham,

Thank you very much for your help. Creative BASIC is a wonderful tool!

Have a nice day ;D,

- Pablo

Offline GWS

  • Moderator
  • Sr. Member
  • *****
  • Posts: 352
  • Bananas: 14
Re: Menu Separator?
« Reply #5 on: February 16, 2015, 08:42:25 PM »
You're welcome ..  :)

I'm surprised how many views this discussion has received, so here's a small example program using a menu separator ..

Code: [Select]
' Menu Separator Example ..
'
def w:window
def textWidth, textHeight, run : int
def a$ : string

autodefine "off"

window w,0,0,600,450,0,0," Menu Separator Example",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(100,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
' close 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
' Window Exit button ID 1 clicked ...
case 1
run = 0
endselect
case @idmenupick
select @menunum
case 100 :' Menu Exit button ID 100 clicked ...
run = 0
endselect
endselect
return


Sorry if the code formatting gets a bit squiffed by the SMF system  ::)

Best wishes, :)

Graham

Tomorrow may be too late ...

Offline docmann

  • Newbie
  • *
  • Posts: 49
  • Bananas: 3
  • Gender: Male
  • Yippeee! (Whew! ...sure glad I got over that)
Re: Menu Separator?
« Reply #6 on: February 18, 2015, 10:47:00 PM »
Hi Graham!
Thought I'd mention that CB and your code, both still work just fine on Windows 8.1
...been quite awhile since I played around with CB, but your sample code always seems to inspire me to take it for a spin.  Wish I could find the old joy I had in programming and especially in using CB in particular, but I'm afraid that it might be done for good. No worries though... I'll continue to test all that you post if nothing else.

Take care friend!

-Doc-
« Last Edit: February 18, 2015, 10:54:14 PM by docmann »
-Doc-

-----------------------------------------------
I'm just about as good as I never was.

Offline GWS

  • Moderator
  • Sr. Member
  • *****
  • Posts: 352
  • Bananas: 14
Re: Menu Separator?
« Reply #7 on: February 19, 2015, 04:40:40 AM »
Hello Doc,  :) .. so nice to hear from you.

It's nice to know CB is still working on the newer implementations of Windows.  I hope it goes on forever.  :P

I'm still with XP on my working machine, but I've got Win7 on my leisure machine which I bought for Christmas.  I've got it hooked up via an HDMI cable to my TV, so I get large screen viewing of lots of stuff off the Web. ;D

Sounds like you may have gone through a bad time -  I can relate to that, having lost my wife last year, my creative work nosedived.

I'm sort of recovering with the strange view that past life is a sort of dream - much of my life, schools, workplaces, people, are no longer there.  But they remain clear as day in my head.

I still love the simple CB implementation of Basic - it's like an old friend you can always rely on.

I hope you keep well ..  :)

Graham



Tomorrow may be too late ...

 

To link to us use this code/button on your site

http://www.codingmonkeys.com/images/cm_link.gif

ShoutBox!

 

Blue Steel

December 09, 2017, 02:46:53 AM
:) ty fingers crossed
 

Larry McCaughn

December 08, 2017, 04:10:56 PM
I'll give you a Shout out in the Shout Box for being able to put it back up.
 

lurkalot

September 20, 2017, 01:57:54 PM
Hey that's my job. Didn't choose this username for nothing you know.  :)
 

Larry McCaughn

September 19, 2017, 12:24:13 AM
lurking in the shadows, lurkalot.
 

lurkalot

September 16, 2017, 04:39:43 PM
Good evening all.  Where is everyone?
 

lurkalot

September 12, 2017, 12:57:36 PM
Good to hear, it's nice to see a empty error log. ;)
 

Blue Steel

September 12, 2017, 05:04:25 AM
running sites log files overnight heres the result (I know mainly spiners) "There are currently no error log entries." :)
 

lurkalot

September 12, 2017, 03:19:33 AM
Morning all.  :)
 

Blue Steel

September 12, 2017, 01:12:33 AM
Let it all out ..
these are the things I can't do without  ;)

MikeHart

September 11, 2017, 11:14:22 PM
SHOUT SHOUT  :)
 

GWS

September 11, 2017, 08:16:02 PM
Shouting is Go !  ;D
 

Blue Steel

September 11, 2017, 06:54:02 PM
gradually getting there
 

lurkalot

September 11, 2017, 05:22:46 PM
Yay, you found it.  ;)
 

Larry McCaughn

September 11, 2017, 01:07:13 PM
looks like you're making good progress
 

Blue Steel

September 07, 2017, 10:34:19 PM
yay recent topics are working again in the center of the home page :)
 

Larry McCaughn

July 12, 2017, 05:46:33 PM
Blue Steel is back running the show.  Maybe he'll be able to build some steam in the ole place!
 

Blue Steel

June 26, 2017, 04:58:41 AM
hope i didn't scare too many of you
 

Blue Steel

June 26, 2017, 04:58:12 AM
Boo, i'm still here alive and well , see my post in introductions

MikeHart

July 25, 2016, 01:43:24 AM
That sounds cool. Have to chekc out IWBasic in the next days.
 

Larry McCaughn

July 22, 2016, 11:47:00 PM
I'm hoping to issue a new maintenance release to the IWBasic 3.x IDE in the next few weeks and Larry Sikes has released an update to the Linux version of IWBasic and is currently working on the 64bit version of IWBasic.  Progress should speed up since he has retired and has apparently resolved his m

MikeHart

July 19, 2016, 02:53:02 PM
Anything interesting going on around BASIC?
 

Larry McCaughn

July 18, 2016, 09:14:12 AM
Hello Mike

MikeHart

July 16, 2016, 04:33:25 PM
Hi there all!
 

pistol350

June 24, 2016, 03:41:10 AM
Hello all!
I'm still around although less active!