BBC BASIC for Windows
IDE and Compiler >> Debugging >> Missing \
http://bb4w.conforums.com/index.cgi?board=debugging&action=display&num=1427763907

Missing \
Post by CharlesB on Mar 30th, 2015, 11:49pm

I have been learning how to use Windows Dialogue Boxes and having a grand time with it. But, when I compile I am getting a "Missing \" error.

I think that this is associated with the closing of a dialogue box - or the opening of a dialogue box; for it is at this part of my program when I get the error.

I only get it after compiling and I don't have a clue as to what I'm doing wrong. Might anyone have a suggestion as to help me debug this?

Thank you,
Charles
Re: Missing \
Post by rtr2 on Mar 31st, 2015, 12:53am

on Mar 30th, 2015, 11:49pm, CharlesB wrote:
I only get it after compiling and I don't have a clue as to what I'm doing wrong. Might anyone have a suggestion as to help me debug this?

It's impossible to say without seeing the code. List the section where you believe the error is occurring.

Richard.

Re: Missing \
Post by CharlesB on Mar 31st, 2015, 1:46pm

Thank you.
I think that the problems is as follows.

Below is a snip of the code. I realize that if one runs this in the interpreter, he/she might get errors. (This is due to my deleting some code so this snip can stand alone)

But, in the compiled example the program crashes before one sees the dialogue box.

At least here, one can see the dialogue box.

In the larger program I received a "Missing \ "error when compiled.
In the compiled version of this smaller program I am receiving a "syntax error."

I don't think I quite understand how I am to copy code into this box, so here it is . . . cut and paste . . . and I apologize for how amateurish this may be.

This is a modification of the Example program of the dialogue box.

Charles

DEF PROC_AskForFeetOrPieces
REM. Program to demonstrate a Dialogue Box
INSTALL @lib$+"WINLIB2"

BS_DEFPUSHBUTTON = &1
CB_ADDSTRING = &143
CB_SETCURSEL = &14E
CBS_DROPDOWNLIST = &3
ES_AUTOHSCROLL = &80
ES_NUMBER = &2000
LB_ADDSTRING = &180
LB_GETCURSEL = &188
UDM_SETRANGE = &465
UDS_ALIGNRIGHT = &4
UDS_AUTOBUDDY = &10
UDS_SETBUDDYINT = &2
WS_CHILD = &40000000
WS_GROUP = &20000
WS_VISIBLE = &10000000

REM dlg%=FN_newdialog("Select Quotation", 40, 40, 200, 135, 8, 550)
REM PROC_groupbox(dlg%, "Cutting Box", 0, 4, 4, 152, 96, WS_GROUP)
REM dialogue1$= STR$(od)+ " x "+ STR$(id) + " ("+STR$(wall)+" w)"
dlg%=FN_newdialog("test", 40, 40, 270, 135, 10, 650)
PROC_groupbox(dlg%, "Cutting Modes", 0, 4, 4, 152, 96, WS_GROUP)

PROC_editbox(dlg%, "Setup Charge", 101, 12, 20, 64, 12, LB_ADDSTRING)
REM PROC_dlgctrl(dlg%, "", 109, 0, 0, 12, 12, WS_VISIBLE OR WS_CHILD OR \
\ UDS_AUTOBUDDY OR UDS_ALIGNRIGHT OR UDS_SETBUDDYINT, "msctls_updown32")

PROC_editbox(dlg%, "Enter Len/Cut", 102, 82, 20, 64, 12, LB_ADDSTRING)
REM proc_editbox(dlg%, "Price/cut", 102, 160, 20, 120, 12, LB_ADDSTRING)
PROC_combobox(dlg%, "", 103, 12, 40, 64, 60, CBS_DROPDOWNLIST)
PROC_listbox(dlg%, "", 104, 82, 40, 64, 48, 0)
PROC_editbox(dlg%, "Price/cut", 106, 160, 20, 120, 12, LB_ADDSTRING)
PROC_radiobutton(dlg%, "Standard Price", 105, 12, 64, 64, 10, 0)
PROC_radiobutton(dlg%, "Special Charge", 106, 12, 82, 64, 10, 0)
PROC_checkbox(dlg%, "Special Instructions", 107, 82, 82, 64, 10, 0)

PROC_pushbutton(dlg%, "OK", 1, 12, 108, 56, 14, WS_GROUP OR BS_DEFPUSHBUTTON)
PROC_pushbutton(dlg%, "Cancel", 2, 92, 108, 56, 14, 0)

PROC_showdialog(dlg%)
ON CLOSE PROC_closedialog(dlg%):QUIT
ON ERROR PROC_closedialog(dlg%)tongueRINT'REPORT$:END

SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Regular"
SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "SawCut"
SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Core Blade Cut"
SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Core Lathe Cut"
SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Special"
SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Combobox"
SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Combobox"

SYS "SendDlgItemMessage", !dlg%, 103, CB_SETCURSEL, 0, 0

SYS "SendDlgItemMessage", !dlg%, 104, LB_ADDSTRING, 0, "1 Cut In Inches"
SYS "SendDlgItemMessage", !dlg%, 104, LB_ADDSTRING, 0, "2 Cut in Feet"
SYS "SendDlgItemMessage", !dlg%, 104, LB_ADDSTRING, 0, "3 Cut Metric mm"
SYS "SendDlgItemMessage", !dlg%, 104, LB_ADDSTRING, 0, "4 Cut Metric cm"
SYS "SendDlgItemMessage", !dlg%, 104, LB_ADDSTRING, 0, "5 Cut Other"
SYS "CheckRadioButton", !dlg%, 105, 106, 105
SYS "SendDlgItemMessage", !dlg%, 109, UDM_SETRANGE, 0, 999

Click%=0
ON SYS Click% = @wparam% : RETURN
REPEAT
WAIT 1
click%=0
SWAP Click%, click%
UNTIL click%=1 OR click%=2 OR !dlg%=0

IF click%=1 THEN
PRINT "OK pressed, settings were:"'

DIM text% 25
SYS "GetDlgItemText", !dlg%, 101, text%, 255

PRINT "Setupcharge ($$text%) is """$$text%""""
IF $$text% = "Setup Chg" THEN Setupcharge=0
IF $$text%<> "Setup Chg" THEN Setupcharge=VAL($$text%)


SYS "GetDlgItemText", !dlg%, 102, text%, 255
PRINT "LENGTH OF CUT """$$text%""""
The_length_of_cut = VAL($$text%)



PROC_closedialog(dlg%)


ENDPROC


Re: Missing \
Post by DDRM on Mar 31st, 2015, 3:00pm

Hi Charles,

Actually, once I've corrected the smiley to :P ;-) it seems to work OK in the IDE, but stops with a "missing \" error once compiled.

I think the problem is that you have REMMED out a line, but it continues onto the next line, and the interpreter is foxed by finding the line continuation marker without a previous line to continue! If you REM out the continuation, it seems to work OK.

The fault seems to be in the REM line which starts PROC_dlgctrl(...

(You should also lose the DEFPROC at the beginning, and the ENDPROC at the end of your snippet, since it is no longer functioning as a procedure...)

Hope that helps (and is right, or Richard will be after me! :-) )

D
Re: Missing \
Post by rtr2 on Mar 31st, 2015, 3:24pm

on Mar 31st, 2015, 3:00pm, DDRM wrote:
Actually, once I've corrected the smiley to :P ;-)

I would request that everybody please takes the trouble to list code surrounded by [code] tags; it is after all one of the principal advantages of this forum over, for example, the Yahoo group.

Quote:
I think the problem is that you have REMMED out a line, but it continues onto the next line

That's one way of putting it. Everything following REM is ignored by the interpreter, which is why you can include keywords, accented characters etc. in a remark without them confusing BBC BASIC. But it follows that the line-continuation character \ is also ignored following REM, so you cannot 'continue' a REM on the following line. There's no cause to anyway, since you might as well start the next line with REM as with \.

I wonder if the OP is familiar with the Add REMs option in the right-click (or Shift+F10) context menu. That's the easiest way of 'commenting out' a block of code, and will avoid the problem so long as any continuation lines are included in the block to be REMmed.

Richard.
Re: Missing \
Post by CharlesB on Mar 31st, 2015, 6:01pm

Thank you all so very much.
I will look into this right after work (am at lunch).

Sorry about not including the code tags. Frankly, even when Svein told me what to do, I did not understand him.

He said "

PS. Use the 'code' tags when posting code to avoid corruption of the code.
In this case there is a smiley instead of PRINT.
Which becomes 'tongueRINT' when pasted into the IDE.
Hint: press the # button and put your code in between the 'code' and '/code' ."

I can understand hitting the # key and then the code, but do not know what he meant by 'code' and '/code."

Is there an example on the message board on how to post the code?

Again, thank you all so very much,
Charles