Post by tsh73 on Nov 7, 2021 9:17:42 GMT
Just found - it happens that we can use popup menu
without making all that million labels!
without making all that million labels!
[Apples]
[RedApples]
[LargeRedApples]
[Apples]
[GreenApples] (label not defined)
[Apples]
[RedApples]
[SmallRedApples] (label not defined)
[Pears]
[RedPears] (label not defined)
[Pears]
[GreenPears] (label not defined)
'tsh73 Nov 2021
'popupmenu without defined labels (on error trick)
' It happens that we can use popup menu
' without making all that million of labels!
open "test" for graphics_nsb_nf as #gr
#gr "down; trapclose [quit]"
#gr "home; posxy cx cy"
'#gr "font Times_new_roman 16"
txt$="do some clicking, check mainwin"
'txtW=200
#gr "stringwidth? txt$ txtW"
#gr "place ";cx-txtW/2;" ";cy
#gr "\";txt$
#gr, "when leftButtonDown [popup1]"
on error goto [err]
wait
[popup1]
level = 0
popupmenu "Apples", [Apples], "Pears", [Pears] 'first popupmenu
wait
[Apples]
lbl$ = "[Apples]"
print space$(4*level);lbl$
level = level +1
popupmenu "RedApples", [RedApples], "Green Apples", [GreenApples]
wait
[Pears]
lbl$ = "[Pears]"
print space$(4*level);lbl$
level = level +1
popupmenu "Red Pears", [RedPears], "Green Pears", [GreenPears]
wait
[RedApples]
lbl$ = "[RedApples]"
print space$(4*level);lbl$
level = level +1
popupmenu "Large Red Apples", [LargeRedApples], "Small Red Apples", [SmallRedApples]
wait
[LargeRedApples]
lbl$ = "[LargeRedApples]"
print space$(4*level);lbl$
notice "end of chain, see mainwin"
wait
'etc
wait
[quit]
close #gr
end
[err]
if Err=8 then
'notice "Error!"+chr$(13)+"Likely label not defined yet"+chr$(13)+str$(Err)+" "+Err$
'print Err$
'Branch label not found: [GreenApples]
lbl$=mid$(Err$, len("Branch label not found: ")+1)
'print ">";lbl$;"<"
print space$(4*level);lbl$; " (label not defined)"
else
notice "Error!"+chr$(13)+Err$
goto [quit]
end if
wait