Curiosity: rules for spaces around \ in vars with structures

Just starting out? Need help? Post your questions and find answers here.
User avatar
Thumper
User
User
Posts: 97
Joined: Sat Feb 01, 2014 2:16 am
Location: Alabama USA

Curiosity: rules for spaces around \ in vars with structures

Post by Thumper »

Not a real problem here as this is so easily solved but has me curious what the rules are.

I have something like "scriptDetails \ oneTouch04" and I like to surrounding symbols with spaces for readability. This usually is fine but there are times it requires removing the spaces to make it "script\oneTouch04".

Here is one specific example generating an error on the \text1 (.s in the structure) line storing the string: "Can't write a numerical value into a string variable". Removing the spaces fixes the error. I left a few extra lines to show how the other places do not generate an error. (BTW, I love the "with" command!)

Code: Select all

     with wEditor\onetouch07
          \id = canvasGadget ( #pb_any, x2, y3, wFF, h3 )
          \text1 = scriptDetails \ oneTouch07
          \align = #myButton_alignleft
          \type = #myButton_player
          \style = #myButton_themeColors
     endWith
     enableGadgetDrop ( wEditor \ onetouch07 \ id, #pb_drop_private, #pb_drag_copy | #pb_drag_move | #pb_drag_link, 1 )
     drawButton      ( @wEditor \ onetouch07 )

     y3 = y3 + h3 + h4
Elsewhere the space is accepted just fine:

Code: Select all

     procedure pbpp_g_wEditor_onetouch04 ( event.i )
          select event
               case #pb_event_gadgetDrop
                    scriptDetails \ oneTouch04 = stringField ( dragAndDrop, 1, "|" )
                    wEditor \ onetouch04 \ text1 = scriptDetails \ oneTouch04
                    drawButton ( @wEditor \ oneTouch04 )
                    dragAndDrop = ""
                    dragAndDropSource = 0
          endSelect
     endProcedure
as does

Code: Select all

     writeStringN ( handle, "ONETOUCH05" + chr(9) + scriptDetails \ oneTouch05 )
Anyhow, just a curiosity. I just use the spaces per habit and remove them when the compiler barks.

Cheers
I enter the PureBasic world, targeting both Mac and Windows, by way of PowerBasic, Win32API, EZGUI back to CP/M via various BASIC dialects, xBase and other languages as needed.
Side project: http://www.thecomputerarchive.com