[ FAQ ]
Frequently Asked Questions
If, after reading the iziBasic docs, you still have questions, check here.
If you don't find your answer here, please ask the friendly folks in the iziBasic forum .
General
What does "izi" in "iziBasic" mean?
"izi" means "easy", hence "iziBasic" is "easy" Basic.
Compiler Errors
Why do I get a syntax error when I try to declare a variable called maxRows?
Unlike most other BASIC dialects, iziBasic requires custom variables to start with %, and end with % (for numbers) or $ (for strings):
- Example custom number variable - %maxRows%
- Example custom string variable - %fileName$
Why do I get syntax errors in statements that look fine?
Common causes of syntax errors:
- Custom variables (e.g. %foobar%) - You mispelled it or forgot to declare it with DIM.
- More common causes?
Why am I getting syntax errors in my SELECT CASE statements?
- Are you trying to use a variable or expression in one of the CASE statements? Currently, iziBasic only permits a literal number. For example, "CASE 1" is OK, but "CASE %foobar%" is not.
Runtime Problems
My program compiles but doesn't run right. I've checked the code several times. What's wrong?
- You may have forgot the THEN keyword in your IF statements. THEN is required if you're using the ELSE option, but currently the compiler does not detect this omission. So, check all your IF statements first.
- More common gotchas?
Data Files
I'm trying to use OPEN to read/write files, but nothing happens. Why?
- If you're opening for INPUT or RANDOM, first make sure the file exists using the FILEEXISTS command.
- When assigning a number to the file ("...AS #1"), make sure the number is in the range 0-9. This ID is only used for files, and will not conflict with the IDs used for controls or other objects.
- Set the {SECUREFILES} compiler directive to OFF. If you leave it on (the default), it will only let you deal with files with CreatorID=LDIB (those associated with iziBasic itself). If you're reading/writing your own files, they'll have the same CreatorID as your program, not LDIB.
Does the FILEEXISTS command want a full file name (e.g. "foobar.pdb") or just the root name (e.g. "foobar")?
Like the other file commands, just use the root with no file extension.
Detecting an Open Menu with Doevents
My app periodically writes to the screen. I also use a menu (MBAR resource) and when the menu is opened, my code overwrites it. What’s going on?
If the menu has been opened, further writes to the screen will not appear on the form but, instead, on the active menu, thereby overwriting it. Trapping the menu item with doevents will not prevent this because doevents does not return an event if the menu has been opened, only if a menuitem has been ticked (event 1001). The simple code below modifies doevents, and returns a new event 1003 if the menu has been opened but no item yet selected. Your code can then check for event 1003 and stop further screen updates until the menu has been released. This fix works by checking for a white pixel at screen location 159,1, which is at the top right of the title bar. A white pixel indicates the menu has been opened. (My screen width is 160, so if yours is different you must change the pget below.) This code only works, however, if your current form is a custom modal form.
_DoEvents: a=doevents b=pget(159,1) if b=16777215 a=1003 ‘16777215=$FFFFFF=white returnFor non-modal forms, like IziBasic’s form 0, it is a little more complicated. First, you must set an inconspicuous pixel to a non-menu color, then check for that color. If the color has changed, the menu has been ticked. In the code below, I enable menu detection by setting pixel 0,15 (top, left, just below the title bar) to black (color 0). Then proceed with _DoEvents in a similar fashion.
_EnableMenuDetect: color 0 pset 0,15 return
_DoEvents: a=doevents b=pget(0,15) if b<>0 a=1003 ‘0=black,if pixel not black menu opened return(Submitted by JoeV)