RAspberry Pi , Stringgadget doesn't accept input
Posted: Tue Jan 10, 2023 9:33 pm
by PitH
Hello, i just tried Purebasic on a Pi
i took a Purebasic program source which i wrote for Windows , transferred it to the Pi an ran it within Purebasic Ide.
the program started , but if i select a stringgadget and want to provide the needed input
nothing happens, even the #PB_Text_Center seemed not to work cause the cursor is blinking on the left side .
can somebody help ?
Re: RAspberry Pi , Stringgadget doesn't accept input
Posted: Tue Jan 10, 2023 10:00 pm
by jacdelad
No code, no help...
Re: RAspberry Pi , Stringgadget doesn't accept input
Posted: Tue Jan 10, 2023 10:11 pm
by PitH
sorry.. i beg your pardon:
here only the important parts (with windows it works):
Global Quit.b = #False
Declare CreateList(*value)
#FLAGS = #PB_Window_ScreenCentered
OpenWindow(#WIN_MAIN, 0, 0, 800, 400, "xxx", #FLAGS)
AddWindowTimer(#WIN_MAIN, 0, 500) ; Updates the clock every half-second.
If UseGadgetList(WindowID(#WIN_MAIN))
ButtonGadget(#Button1, 230, 350, 55, 25, "START")
ButtonGadget(#Button_Program_End, 515, 350, 55, 25, "EXIT")
TextGadget(#Text_Line1, 20, 20, 760, 25, "xxxx", #PB_Text_Center)
TextGadget(#Text_Line2, 20, 40, 760, 25, "Die Datenbank muss sich im GLEICHEN Verzeichnis wie das Programm befinden, das Ergebnis ist mit ; getrennt.", #PB_Text_Center)
TextGadget(#Text_Line3, 120, 60, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line4, 20, 85, 760, 25, "Suchparameter: Es wird nach Eintraegen gesucht, die die Eingabe enthalten. Nicht benoetigte Felder LEER lassen :")
TextGadget(#Text_Line5, 20, 115, 100, 25, "Entity_ID :", #PB_Text_Center)
StringGadget(#String_Line1, 120, 110, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line6, 20, 150, 100, 25, "State :", #PB_Text_Center)
StringGadget(#String_Line2, 120, 145, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line7, 20, 185, 115, 25, "Last_Updated :")
StringGadget(#String_Line3, 120, 180, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line8, 120, 205, 650, 50, "Last_Updated Eingabe-Format: YYYY-MM-DD HH:MM:SS (zwischen Datum und Uhrzeit LEERZEICHEN) oder eben Teile davon.", #PB_Text_Center)
TextGadget(#Text_Line9, 20, 300, 100, 25, "Results :", #PB_Text_Center)
TextGadget(#Text_Line10, 120, 300, 650, 25, "", #PB_Text_Center | #PB_Text_Border)
EndIf
....
Repeat
Event.l = WaitWindowEvent()
Select Event.l
Case #PB_Event_Gadget
Select EventGadget()
Case #Button1
If GetGadgetText(#Text_Line3) = " R E A D Y ! " Or GetGadgetText(#Text_Line3) = ""
SetGadgetText(#Text_Line10,"0")
CreateThread(@CreateList(),1)
EndIf
Case #Button_Program_End
If GetGadgetText(#Text_Line3) = " R E A D Y ! " Or GetGadgetText(#Text_Line3) = ""
Quit.b = #True
EndIf
EndSelect
EndSelect
Until Quit.b = #True
End
......
Procedure CreateList(*value)
SetGadgetColor(#Text_Line3, #PB_Gadget_BackColor, $0000EE)
SetGadgetText(#Text_Line3," R U N N I N G ! ")
Dim A$(20)
Entity_ID$ = GetGadgetText(#String_Line1)
State$ = GetGadgetText(#String_Line2)
Last_Updated$ = GetGadgetText(#String_Line3)
.......
EndProcedure
Re: RAspberry Pi , Stringgadget doesn't accept input
Posted: Tue Jan 10, 2023 10:13 pm
by jacdelad
This code doesn't work, because it misses the enumerations.
I'll take a look at it anyway...
Also, please use code tags in your posts!
Re: RAspberry Pi , Stringgadget doesn't accept input
Posted: Tue Jan 10, 2023 10:21 pm
by jacdelad
Regarding your problem:
You don't use "EnableExplicit". This causes problems when using variables and adding a typo.
Anyway, I'm surprised that this code shall work under Windows: The array "a$()" is defined within in the procedure "CreateList()", which is left immediately after reading text from the string inputs. Leaving the procedure means, that all local defined variables are freed, so your input is gone. In short words: you can only use the content of Entity-ID$, State$ and Last_Updated$ within the procedure "CreateList()".
Also, I'm not sure what you're trying to do, especially when creating the threads.
Ans last but not least, I don't know why #PB_Text_Center doesn't work on the Pi, I can only access Windows right now.
Code: Select all
Enumeration;Windows
#WIN_MAIN
EndEnumeration
Enumeration;Gadgets
#Button1
#Button_Program_End
#Text_Line1
#Text_Line2
#Text_Line3
#Text_Line4
#Text_Line5
#Text_Line6
#Text_Line7
#Text_Line8
#Text_Line9
#Text_Line10
#String_Line1
#String_Line2
#String_Line3
EndEnumeration
Global Quit.b = #False
Declare CreateList(*value)
#FLAGS = #PB_Window_ScreenCentered
OpenWindow(#WIN_MAIN, 0, 0, 800, 400, "xxx", #FLAGS)
AddWindowTimer(#WIN_MAIN, 0, 500) ; Updates the clock every half-second.
If UseGadgetList(WindowID(#WIN_MAIN))
ButtonGadget(#Button1, 230, 350, 55, 25, "START")
ButtonGadget(#Button_Program_End, 515, 350, 55, 25, "EXIT")
TextGadget(#Text_Line1, 20, 20, 760, 25, "xxxx", #PB_Text_Center)
TextGadget(#Text_Line2, 20, 40, 760, 25, "Die Datenbank muss sich im GLEICHEN Verzeichnis wie das Programm befinden, das Ergebnis ist mit ; getrennt.", #PB_Text_Center)
TextGadget(#Text_Line3, 120, 60, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line4, 20, 85, 760, 25, "Suchparameter: Es wird nach Eintraegen gesucht, die die Eingabe enthalten. Nicht benoetigte Felder LEER lassen :")
TextGadget(#Text_Line5, 20, 115, 100, 25, "Entity_ID :", #PB_Text_Center)
StringGadget(#String_Line1, 120, 110, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line6, 20, 150, 100, 25, "State :", #PB_Text_Center)
StringGadget(#String_Line2, 120, 145, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line7, 20, 185, 115, 25, "Last_Updated :")
StringGadget(#String_Line3, 120, 180, 650, 25, "", #PB_Text_Center)
TextGadget(#Text_Line8, 120, 205, 650, 50, "Last_Updated Eingabe-Format: YYYY-MM-DD HH:MM:SS (zwischen Datum und Uhrzeit LEERZEICHEN) oder eben Teile davon.", #PB_Text_Center)
TextGadget(#Text_Line9, 20, 300, 100, 25, "Results :", #PB_Text_Center)
TextGadget(#Text_Line10, 120, 300, 650, 25, "", #PB_Text_Center | #PB_Text_Border)
EndIf
Repeat
Event.l = WaitWindowEvent()
Select Event.l
Case #PB_Event_Gadget
Select EventGadget()
Case #Button1
If GetGadgetText(#Text_Line3) = " R E A D Y ! " Or GetGadgetText(#Text_Line3) = ""
SetGadgetText(#Text_Line10,"0")
CreateThread(@CreateList(),1)
EndIf
Case #Button_Program_End
If GetGadgetText(#Text_Line3) = " R E A D Y ! " Or GetGadgetText(#Text_Line3) = ""
Quit.b = #True
EndIf
EndSelect
EndSelect
Until Quit.b = #True
End
Procedure CreateList(*value)
SetGadgetColor(#Text_Line3, #PB_Gadget_BackColor, $0000EE)
SetGadgetText(#Text_Line3," R U N N I N G ! ")
Dim A$(20)
Entity_ID$ = GetGadgetText(#String_Line1)
State$ = GetGadgetText(#String_Line2)
Last_Updated$ = GetGadgetText(#String_Line3)
;Dein Code zur Abfrage hier rein!
EndProcedure
Re: RAspberry Pi , Stringgadget doesn't accept input
Posted: Tue Jan 10, 2023 10:35 pm
by PitH
It works on Windows flawless !
AND the variables are only needed within the procedure .
Code: Select all
#Button1 = 1
#Button_Program_End = 9
#Text_Line1 = 20
#Text_Line2 = 21
#Text_Line3 = 22
#Text_Line4 = 23
#Text_Line5 = 24
#Text_Line6 = 25
#Text_Line7 = 26
#Text_Line8 = 27
#Text_Line9 = 28
#Text_Line10 = 29
#String_Line1 = 30
#String_Line2 = 31
#String_Line3 = 32
UseSQLiteDatabase()
#Database = 100
#Liste = 103
Declare CreateList(*value)
Global Quit.b = #False
#FLAGS = #PB_Window_ScreenCentered
Re: RAspberry Pi , Stringgadget doesn't accept input
Posted: Thu Jan 19, 2023 12:03 am
by HeX0R
jacdelad wrote: Tue Jan 10, 2023 10:21 pm
Ans last but not least, I don't know why #PB_Text_Center doesn't work on the Pi, I can only access Windows right now.
Because #PB_
Text_Center is for TextGadgets, not for StringGadgets!
If it works on Windows, it was just luck, because it is not officially supported.
Re: RAspberry Pi , Stringgadget doesn't accept input
Posted: Thu Jan 19, 2023 4:03 pm
by jacdelad
HeX0R wrote: Thu Jan 19, 2023 12:03 am
jacdelad wrote: Tue Jan 10, 2023 10:21 pm
Ans last but not least, I don't know why #PB_Text_Center doesn't work on the Pi, I can only access Windows right now.
Because #PB_
Text_Center is for TextGadgets, not for StringGadgets!
If it works on Windows, it was just luck, because it is not officially supported.
Yeah, I already found out and posted it in the other thread.
viewtopic.php?p=593650#p593650