See https://nitisara.ru/forum/viewtopic.php ... 627#p15627
That's why I posted it here in the hope that someone can help.
I've been trying to make a background for a custom toolbar for some time now, but I can't.
I want to create the toolbar in a separate page that remains visible and then return to the default page "" on which the program should generate the output.
The code below gives a minimal example:
Code: Select all
' Problem with pages
'm'
SET BUTTONS CUSTOM
GET SCREEN SIZE sw,sh
GRAPHICS
GRAPHICS CLEAR 0.5,0.5,0.5
' Set bar backgroundcolor
'loop for action, do something
y=sh/2
DO SLOWDOWN ' relax while doing
FILL COLOR RND(1),RND(1),RND(1)
FILL CIRCLE sw/2, y SIZE 100
y-=sh/20
REFRESH
Checkbutton:
REM IF NOT buttonbar THEN END
pause 0.03
UNTIL y<-5
END ' of testprogram
''
'b'
' Function to create bar with stop button
' If stop-button has been pressed then the function returns 0, else 1
'g'
DEF ButtonBar
sw=.sw ! sh=.sh
IF NOT Init THEN GOSUB CreateButton
'get base option
base=SUBSTR$("10",1,1)
'Set bar background on separate page
' so that it will not be cleared by GRAPHICS CLEAR
PAGE "bar" SET
PAGE "bar" COLOR 0,0,1,0.5
PAGE "bar" FRAME 0,0,sw,22
PAGE "bar" SET
PAGE "bar" SHOW
PAGE "" SET
PAGE "" SHOW
'b' Check stop button
IF BUTTON_PRESSED("stop") THEN RETURN 0
RETURN 1 ' from function
CreateButton:
' create all toolbar buttons
ypos=-6
FILL COLOR 0,0,0
DRAW COLOR 1,1,1
FILL ALPHA 0
DRAW ALPHA 1
BUTTON "stop" TEXT "stop" AT int(sw*.4),ypos
init=1
END DEF
[/code
If you run that program, you will see circles drawn from the center of the screen to the top, after which the program stops.
If you remove the "REM" statement after the "Checkbutton:" label, the program will display a colored top bar, but only draw one circle and stop after the usual time. While running, the program can be stopped prematurely by pressing "stop" in the top bar.
Why don't the other circles appear?
How can I fix this?