aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
296 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
StatPays
En ligne

Colombia : 4
United States : 6
China : 3
Greece : 1



Depuis le 11/02/2009

France:3249243
United States:1011771
United Kingdom:527697
Germany:290535
Italy:246122
Canada:178571
Belgium:163583
Japan:124726
Spain:102914
Russian Federation:91148
Switzerland:84533
Netherlands:83691
Mexico:76530
Brazil:66573
Argentina:59224
Czech Republic:51452
Poland:48950
Morocco:47300
China:44920
Colombia:40510
Hungary:38976
Turkey:35325
Australia:35116
Portugal:28839
Sweden:26631
Austria:23412
Taiwan:21649
Finland:20429
Denmark:20080
Venezuela:15533
India:13399
Romania:12814
Korea:11697
Greece:11427
Norway:11119
New Zealand:10789
Chile:10575
Luxembourg:10288
Slovakia:8642
Croatia:8271
Ireland:8086
Ukraine:8071
Indonesia:8016
Malaysia:7445
South Africa:6413
Uruguay:6370
Singapore:6222
Israel:5713
Peru:5160
Estonia:4555
Bulgaria:4407
Thailand:4204
Lithuania:4109
Cote D'Ivoire:3026
Madagascar:2920
New Caledonia:2580
Gibraltar:2569
Belarus:2187
Hong Kong:2146
French Polynesia:2145
Dominican Republic:1720
Saudi Arabia:1643
Philippines:1635
Latvia:1519
Serbia and Montenegro:1518
Pakistan:1488
Moldova:1444
Algeria:1412
United Arab Emirates:1370
Guatemala:1295
Slovenia:1254
Ecuador:1232
Bosnia and Herzegovina:987
Costa Rica:956
Tuvalu:924
Vietnam:915
Monaco:871
Paraguay:807
Egypt:786
Macedonia:541
Bolivia:499
GoogleBot:466
Nicaragua:446
Guadeloupe:435
Cyprus:403
Lebanon:372
Kazakstan:363
Cuba:361
Honduras:361
Netherlands Antilles:351
Syrian Arab Republic:287
Jordan:276
Mauritius:244
Albania:234
Kenya:234
Andorra:223
Ghana:223
Nepal:212
Georgia:202
Reunion:191
Mozambique:180
Congo:180
Uzbekistan:30
Jamaica:2
Zimbabwe:1
Iran:1
Trinidad and Tobago:
forum.gifForum - iziBasic - Topic #1636

Forum - Forum
iziBasic - iziBasic


active  Topic # 1636  If/Then Error.

18/04/2009 @ 21:31
by mylifedrive

Anonymous

visitor

What is wrong with this line?

if A(%LOP%)-A(1) then goto _TryAgainLabel

The A() array has been dimensioned, and _TryAgainLabel exists.
  Post an answer  Top

[]   

Answer n° 1
--------
19/04/2009 @ 12:41
by aldweb

Anonymous

visitor
Hello,

Explanations about the issue you face are explained in the FAQ of the user manual, paragraph Complex tests in conditional statements.

Your line should be converted like this:
B=A(%LOP%)-A(1) : IF B>0 GOTO _TryAgainLabel


Cheers,
aldweb
Write to aldweb   Post an answer  Top
Answer n° 2
--------
19/04/2009 @ 21:44
by mylifedrive

Anonymous

visitor
Thanks. That helped. Please can you now tell me what is wrong with this code? I get a number stack overflow when I run the program.

I cannot seem to post my code here unless I post the .ibas.pdb

I have uploaded it to my own site. Here is the link:

http://sitebuilder.yola.com/sites/D575/D3f9/D130/De40/U8a4986c81c03c820011c04e0319f3575/8a4986c81c03c820011c235db0560e30/resources/Mini%20Cash%20Case.ibas.pdb
  Post an answer  Top
Answer n° 3
--------
20/04/2009 @ 21:07
by aldweb

Anonymous

visitor
Hello,

Your mistake is at the beginning of the events loop. Just after the repeat statement, you do some calculations with %BTN$ which is not filled with a value until the user clicks on one button. So %BTN$="".
Then %BTN%=0 and A(%BTN%) is A(0) which is out of range, thus bringing the number stack overflow.
Well, that is my guess from reading quickly your source code.
All of these lines between the repeat and the %EVT%=WAITEVENT lines should be put in a gosub/return procedure and called only after the user clicked on one button.

Cheers,
aldweb
Write to aldweb   Post an answer  Top
Answer n° 4
--------
21/04/2009 @ 04:52
by mylifedrive

Anonymous

visitor
Thanks, that worked. But now... *sigh* I have another problem. My program freezes up when I run it and I am forced to reset. I am thinking persaps somehow there is an infinite loop here:

WHILE %LOP% <> 9

%LOP% = %LOP% + 1

_TryAgainLabel:

%VLU% = RND(8)

if %VLU%=0 then %VLU%=1

end if

A(%LOP%)=%VLU%

%AARRAY% = A(%LOP%)







if %LOP% = 1 then goto _one : End If

%AARRAY2%=A(1) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_one:

if %LOP% = 2 then goto _two : End If

%AARRAY2%=A(2) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_two:

if %LOP% = 3 then goto _three : End If

%AARRAY2%=A(3) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_three:

if %LOP% = 4 then goto _four : End If

%AARRAY2%=A(4) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_four:

if %LOP% = 5 then goto _five : End If

%AARRAY2%=A(5) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_five:

if %LOP% = 6 then goto _six : End If

%AARRAY2%=A(6) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_six:

if %LOP% = 7 then goto _seven : End If

%AARRAY2%=A(7) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_seven:

if %LOP% = 8 then goto _eight : End If

%AARRAY2%=A(8) : if %AARRAY%=%AARRAY2% then goto _TryAgainLabel :end if

_eight:



WEND



What I am trying to do is get the array A() to hold the numbers 1-8 randomly in the 1-8 sections. But I am having trouble, sorry.
  Post an answer  Top
Answer n° 5
--------
27/04/2009 @ 16:31
by mylifedrive

Anonymous

visitor
Bump? :D
  Post an answer  Top
Answer n° 6
--------
27/04/2009 @ 21:22
by aldweb

Anonymous

visitor
No more bump!

' Mini Cash Case.ibas

' Listing generated by ViziBasic v2.1
' 17/04/2009 @ 18:04:37

{CREATORID "WTVr"}
{VERSION "0.1"}
'{MINOSVERSION "3.0"}
'{PARSER OFF}
'{KEYEVENTS OFF}
'{SECUREFILES ON}
'{CONSOLEFONT ON}

DIM %EVT%,%P1%,%P2%,%P3%
DIM %P1$,%P2$,%P3$,%BTN%,%AARRAY$
DIM %BTN$,%TXT$,%VLU%,%LOP%
DIM A(80)
DIM %AARRAY%,%AARRAY2%

_Clicky:
%TXT$="You clicked case #"+%BTN$
UPDATELABEL #9,%TXT$
%BTN% = VAL(%BTN$)

%AARRAY2% = A(%BTN%)
%AARRAY$ = STR$(%AARRAY2%,0)
%TXT$="It was worth $" + %AARRAY$
UPDATELABEL #10,%TXT$
%EVT%=WAITEVENT
RETURN

_TryAgainLabel:
%LOP% = %LOP% + 1
%VLU% = RND(8)
if %VLU%=0 let %VLU%=1
A(%LOP%)=%VLU%
%AARRAY% = A(%LOP%)
return

BEGIN
GOSUB _OnAppStart
%P1$="This is just a *very* rough draft¶¶v.0.1"
ABOUTBOX %P1$
GOSUB _GenerateGUI

A(1)=0

WHILE %LOP% <> 9
gosub _TryAgainLabel
%AARRAY2%=A(1) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
%AARRAY2%=A(2) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
%AARRAY2%=A(3) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
%AARRAY2%=A(4) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
%AARRAY2%=A(5) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
%AARRAY2%=A(6) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
%AARRAY2%=A(7) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
%AARRAY2%=A(8) : if %AARRAY%=%AARRAY2% gosub _TryAgainLabel
WEND


GOSUB _EventsLoop
GOSUB _OnAppExit
END

_GenerateGUI:
%P1$="#1"
SETFONT 0
BUTTON #1,%P1$,5,20,15,15
%P1$="#2"
SETFONT 0
BUTTON #2,%P1$,25,20,15,15
%P1$="#3"
SETFONT 0
BUTTON #3,%P1$,45,20,15,15
%P1$="#4"
SETFONT 0
BUTTON #4,%P1$,65,20,15,15
%P1$="#5"
SETFONT 0
BUTTON #5,%P1$,5,40,15,15
%P1$="#6"
SETFONT 0
BUTTON #6,%P1$,25,40,15,15
%P1$="#7"
SETFONT 0
BUTTON #7,%P1$,45,40,15,15
%P1$="#8"
SETFONT 0
BUTTON #8,%P1$,65,40,15,15
%P1$="You clicked case ..."
SETFONT 0
LABEL #9,%P1$,5,60
%P1$="It was worth..."
SETFONT 0
LABEL #10,%P1$,5,60
RETURN

_EventsLoop:

REPEAT
%EVT%=WAITEVENT
SELECT CASE %EVT%
CASE 1
GOSUB _BUTTON_1
CASE 2
GOSUB _BUTTON_2
CASE 3
GOSUB _BUTTON_3
CASE 4
GOSUB _BUTTON_4
CASE 5
GOSUB _BUTTON_5
CASE 6
GOSUB _BUTTON_6
CASE 7
GOSUB _BUTTON_7
CASE 8
GOSUB _BUTTON_8
END SELECT
UNTIL %EVT%=-1
RETURN

_BUTTON_1:
%BTN$="1"
GOSUB _Clicky
RETURN

_BUTTON_2:
%BTN$="2"
GOSUB _Clicky
RETURN

_BUTTON_3:
%BTN$="3"
GOSUB _Clicky
RETURN

_BUTTON_4:
%BTN$="4"
GOSUB _Clicky
RETURN

_BUTTON_5:
%BTN$="5"
GOSUB _Clicky
RETURN

_BUTTON_6:
%BTN$="6"
GOSUB _Clicky
RETURN

_BUTTON_7:
%BTN$="7"
GOSUB _Clicky
RETURN

_BUTTON_8:
%BTN$="8"
GOSUB _Clicky
RETURN

_OnAppStart:

RETURN

_OnAppExit:

RETURN
Write to aldweb   Post an answer  Top
Answer n° 7
--------
28/04/2009 @ 22:32
by Gary

Anonymous

visitor
In the code below you have
%p1$="something"
and you setfont to 0
then you display the button

Do you need to setfont on each button?

And is it better to let a variable equal something instead of
BUTTON #1,"SOMETHING",T,L,W,H

_GenerateGUI:
%P1$="#1"
SETFONT 0
BUTTON #1,%P1$,5,20,15,15
%P1$="#2"
SETFONT 0
BUTTON #2,%P1$,25,20,15,15
%P1$="#3"
SETFONT 0
BUTTON #3,%P1$,45,20,15,15
%P1$="#4"
SETFONT 0
BUTTON #4,%P1$,65,20,15,15
%P1$="#5"
SETFONT 0
BUTTON #5,%P1$,5,40,15,15
%P1$="#6"
SETFONT 0
BUTTON #6,%P1$,25,40,15,15


Thanks
Gary
Write to Gary   Post an answer  Top
Answer n° 8
--------
28/04/2009 @ 22:37
by aldweb

Anonymous

visitor
No, it is not needed.

BUTTON #1,"SOMETHING",T,L,W,H is a better syntax.

But, the original source code was generated by the ViziBasic add-on which is a little bit less optimized than hand-made coding...

Cheers,
aldweb
Write to aldweb   Post an answer  Top
active topic active   closed topic closed   Important! Important!   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^