|
Post by Rod on Feb 28, 2023 8:36:57 GMT -5
Yeah, I am not sure about the colordialog return values. Remember we are still at Alpha Testing stage where some things are not fully fettled. It returns color names we are not used to and RGB values that seem like percent. For backwards compatibility we would need 255,255,255 and color name. A whole bunch of new color names might be fun to have.
As to the menu we normally code that as part of the initial or main window. So it should just sit above that window and not appear in a new window. But perhaps I dont understand what you think is broken.
|
|
|
Post by regoroxford on Feb 28, 2023 15:37:12 GMT -5
I'm using FileZilla to send files from desktop LB4.5 editor over to RPi 4B without using thumb drives and SD cards. Sounds like I need to relax for necessary amount of time. Thanks
|
|
|
Post by regoroxford on Mar 2, 2023 20:52:49 GMT -5
The code posted here will enable colordialog to function in LB5x32-353 on the RPi 4B. After the user executes colordialog , gosub [fixchosencolor] converts chosen$ to a useable (regular) format. nomainwin
UpperLeftX=1:UpperLeftY=1
WindowWidth=800:WindowHeight=480 'RPi 4B
open "RightClick" for graphics as #1 'Creates a window
#1 "trapclose [quit]"
#1 font("arial", 20)
#1 place(20, 20)
colordialog "white", chosen$ 'fixed for LB5x32-353
gosub [fixchosencolor]
[2000]
#1 place(40, 40)
#1 "color black"
#1 "fill "+chosen$
#1 "\";chosen$
'#1 "\";len(chosen$)
#1 "\";r;" ";g;" ";b
wait
[fixchosencolor]
if instr(chosen$,chr$(40))<>1 then goto [chopcv]
if instr(chosen$,chr$(40))=1 then goto [chopcv&]
[chopcv]'no ()
chosen$=mid$(chosen$,12):return
[chopcv&] 'with ()
a$=mid$(chosen$,12,50)
x= instr(a$,"d:") : y = instr(a$,"g")
r = val(mid$(a$,x+2,y-1))
x= instr(a$,"n:") : y = instr(a$,"b")
g = val(mid$(a$,x+2,y-1))
x= instr(a$,"e:") : y = instr(a$,")")
b = val(mid$(a$,x+2,y-1))
#1 "\";r;" ";g;" ";b
m$=str$(INT(r*255)): #1 "\";m$
n$=str$(INT(g*255)): #1 "\";n$
o$=str$(INT(b*255)): #1 "\";o$
chosen$=m$+" "+n$+" "+o$
#1 "\";chosen$
return
[quit]
close #1
end
|
|
|
Post by regoroxford on Mar 4, 2023 8:41:56 GMT -5
Here is code that works fine on LB 4.5 but will not work on LB5x32-353 on the RPi 4B. Error is that #2.list is already in use. Another stonwall. The error message is not logical.
'open "dashed line" for graphics as #1
[dashedline] 'Listbox useage
UpperLeftX=250:UpperLeftY=50 'X & Y dist from upper left of MAIN screen
WindowWidth = 340 : WindowHeight = 180 'X & Y dist added to the upper numbers to define win print #2 x2=1040 y2=330
options$(0) = "DASHED"
options$(1) = "And then left click one or both ends of the line"
options$(2) = "SOLID"
BackgroundColor$ = "green": ForegroundColor$ = "blue" 'must preceed listbox!
ListboxColor$ = "cyan" 'must preceed listbox!
listbox #2.list, options$(), [selectionMade],20,60,280,65 'upper left pair INSIDE print #2 window
'x2 therefore = 300 & y2 = therefore 125
button #2.list "CONTINUE", [selectionMade], UL,35,8,80,40 'X dist from left edge of print #2 window, 8 is Y dist below title bar
button #2.list "CANCEL", [selectionMade],UR, 35,8,80,40 'X dist from right edge of print #2 window,8 is Y dist below title bar
'80 & 40 can be omitted but cont & can box will be larger
'80 & 40 are additive to 35 & 8 from left & right
open "Select line style" for window as #2
'#2.list font("times_new_roman", 10) 'must come after open
#2.list "singleclickselect"
wait
[selectionMade]
#2.list "selection? selection$"
if selection$ = "DASHED" then dashed$ = "Y" 'dashed$ last until figure$ stored as "linedashed"
if selection$ = "And then left click one or both ends of the line" then close #2 : goto [dashedline]
if selection$ = "SOLID" then dashed$ = "N"
print dashed$
close #2
return
|
|
|
Post by Brandon Parker on Mar 4, 2023 9:42:04 GMT -5
It appears that LB 5 is triggering an error due to the handle names of all three of your controls being "#2.list" in the code. LB 4.5.1 seems to ignore this which actually causes problems down the line. Another issue is that you have a "Return" at the end of the [selectionMade] branch label; this should be a "Wait" statement since the branch is not a "GoSub" structure.
Here is the code as updated to work as I think you intend it to; although, I do not believe the window/control color variables have been implemented in LB 5 yet:
'open "dashed line" for graphics as #1
[dashedline] 'Listbox useage
UpperLeftX=250:UpperLeftY=50 'X & Y dist from upper left of MAIN screen
WindowWidth = 340 : WindowHeight = 180 'X & Y dist added to the upper numbers to define win print #2 x2=1040 y2=330
options$(0) = "DASHED"
options$(1) = "And then left click one or both ends of the line"
options$(2) = "SOLID"
BackgroundColor$ = "green": ForegroundColor$ = "blue" 'must preceed listbox!
ListboxColor$ = "cyan" 'must preceed listbox!
listbox #2.listOptions, options$(), [selectionMade],20,60,280,65 'upper left pair INSIDE print #2 window
'x2 therefore = 300 & y2 = therefore 125
button #2.btnContinue "CONTINUE", [selectionMade], UL,35,8,80,40 'X dist from left edge of print #2 window, 8 is Y dist below title bar
button #2.btnCancel "CANCEL", [selectionMade],UR, 35,8,80,40 'X dist from right edge of print #2 window,8 is Y dist below title bar
'80 & 40 can be omitted but cont & can box will be larger
'80 & 40 are additive to 35 & 8 from left & right
open "Select line style" for window as #2
'#2.listOptions font("times_new_roman", 10) 'must come after open
#2.listOptions "singleclickselect"
wait
[selectionMade]
#2.listOptions "selection? selection$"
if selection$ = "DASHED" then dashed$ = "Y" 'dashed$ last until figure$ stored as "linedashed"
if selection$ = "And then left click one or both ends of the line" then close #2 : goto [dashedline]
if selection$ = "SOLID" then dashed$ = "N"
print dashed$
close #2
Wait
{:0)
Brandon Parker
|
|
|
Post by regoroxford on Mar 6, 2023 17:44:06 GMT -5
Thanks Brandon, I will dig into your fix after supper. New question. Is there a scrollable graphics screen in LB5x32-353 for the RPi 4B? The listbox is something I want to see work.
Edit: Brandon, your fix worked perfectly when copied into my drawing program as a sub routine. The only loss was the ForegorundColor$ & BackgroundColor$ & ListboxColor$. In the rest of the program RPi with LB5x32-353 was accepting #1 "color red" or to use variables #1 "color "+pencolor$.
|
|
|
Post by regoroxford on Sept 7, 2023 8:46:00 GMT -5
import os path = '/home/pi/LB5.0/lb5x32-353/lb5-353' os.chdir(path) cwd = os.getcwd() print(cwd) os.system('./rpi32-353 lb5alpha.im')
After a rebuild on the RPi 4, my previous code** for getting LB5.0 running would not function. The above code for python3.9 is running on the 32 bit software recommended at the top of Raspberrypi Imager. The program resides in my /home/pi directory and to keep Geany from jumping onto the screen, I have to run this python script from IDLE as any other program.
** #!/bin/bash (cd lb5x32-353/lb5-353 && ./rip32-353 lb5alpha.im) "I saved this, with (), to /home/pi dir as lb.sh and from Terminal type sh lb.sh (enter)"
|
|
|
Post by Chris Iverson on Sept 7, 2023 23:19:11 GMT -5
Is the second part, below the #!/bin/bash, actually what you are running to try to start LB5? Like, did you copy that from the script directly? Or did you retype it?
And what happens when you try to run that script?
The reason I ask if it's directly copied is because the command is wrong. You have "rip32" instead of "rpi32" there.
|
|