Author |
Topic: Features that are never used (Read 568 times) |
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: Features that are never used
« Reply #19 on: Mar 23rd, 2015, 5:32pm » |
|
Hi Richard,
I'm not sure you'd ever want to do it this way, but I guess you could use it to cut out the "PROCsys" bit of an ON PROC handler:
Code:
5 PROCMenus
10 ON SYS w%=50+@wparam%:RETURN w%
20 REPEAT
30 WAIT 1
40 UNTIL FALSE
45 END
50 PRINT "Black":END
51 PRINT "RED" :END
100 END
DEFPROCMenus
SYS "CreateMenu" TO hmenu%
SYS "SetMenu", @hwnd%, hmenu%
SYS "AppendMenu", hmenu%, 0, 0, "Blac&k"
SYS "AppendMenu", hmenu%, 0, 1, "&Red"
SYS "DrawMenuBar", @hwnd%
ENDPROC
Incidentally, I was interested to see that I can mix numbered and unnumbered bits of code - not that I'd recommend it...
Obviously you would probably want to jump to a handling routine rather than just a print statement, and I can't see much advantage over doing it the way recommended in the manual, but it IS a potential use for the feature!
I suspect you should probably mask @wparam% with &FFFF?
Best wishes,
D
|
| « Last Edit: Mar 23rd, 2015, 5:37pm by DDRM » |
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: Features that are never used
« Reply #20 on: Mar 23rd, 2015, 8:01pm » |
|
on Mar 23rd, 2015, 5:32pm, DDRM wrote:| I suspect you should probably mask @wparam% with &FFFF? |
|
Not in the case of a menu selection; MSDN says: "Value of the high-order word of wParam... If the message is from a menu, this parameter is 0".
Richard.
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: Features that are never used
« Reply #21 on: Apr 6th, 2015, 10:32pm » |
|
3. ELSEIF condition THEN;
This is the third in an occasional series of posts on features of BBC BASIC for Windows which are so obscure or specialised that they are (virtually) never used.
Some BASIC dialects provide an ELSEIF (or ELSIF) keyword to allow multiple conditions to be conveniently handled without nesting IF statements. Standard BBC BASIC does not support this, but an equivalent functionality can be achieved using CASE:
Code: CASE TRUE OF
WHEN condition1:
REM Do something
WHEN condition2:
REM Do something else
OTHERWISE:
REM Do default action
ENDCASE However BB4W does support a form of ELSEIF, a feature which was added primarily to aid automatic translation from other dialects:
Code: IF condition1 THEN
REM Do something
ELSEIF condition2 THEN;
REM Do something else
ELSE
REM Do default action
ENDIF Note the semicolon ; immediately after the THEN which prevents a new (nested) multi-line IF clause being started.
Richard.
|
|
Logged
|
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: Features that are never used
« Reply #22 on: Apr 9th, 2015, 08:56am » |
|
Hi Richard,
Thanks for the note on ELSEIF. I quite often use the CASE TRUE construction, which is very nice, but I can see that using ELSEIF...THEN; might also work well to make multiple choices clear.
I see that there is one use of it in the wiki - is that enough to earn ELSEIF a brief mention in the manual?
Best wishes,
D
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: Features that are never used
« Reply #23 on: Apr 9th, 2015, 10:13am » |
|
on Apr 9th, 2015, 08:56am, DDRM wrote:| I see that there is one use of it in the wiki - is that enough to earn ELSEIF a brief mention in the manual? |
|
It is already there. ELSEIF is just ELSE IF and is therefore documented under ELSE and IF. It's a standard feature of BBC BASIC, which you could use even on the BBC Micro:
Code: IF condition1 PROCdosomething ELSEIF condition2 PROCdoanotherthing The little-used, BB4W-specific, feature I drew attention to was THEN; (i.e. the trailing semicolon) which is documented, unsurprisingly, under THEN:
http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin7.html#then
Richard.
|
| « Last Edit: Apr 9th, 2015, 10:17am by rtr2 » |
Logged
|
|
|
|
|