save point
This commit is contained in:
parent
1195f20ffb
commit
08ef995805
4 changed files with 71 additions and 19 deletions
BIN
kratom.db
BIN
kratom.db
Binary file not shown.
46
kratom.pb
46
kratom.pb
|
@ -4,6 +4,8 @@
|
|||
|
||||
UseSQLiteDatabase()
|
||||
XIncludeFile "kratomfrm1.pbf"
|
||||
Declare updatelist() ; declare forward procedure
|
||||
|
||||
|
||||
; init code
|
||||
|
||||
|
@ -17,11 +19,46 @@ EndIf
|
|||
|
||||
Openkrt1()
|
||||
|
||||
Procedure btn0click (EventType)
|
||||
;MessageRequester("INFO", "ADD CLICKED")
|
||||
DatabaseUpdate(0,"INSERT into kratom (name, type) Values ('"+GetGadgetText(String_0)+"', '"+GetGadgetText(String_1)+"' );")
|
||||
updatelist()
|
||||
EndProcedure
|
||||
|
||||
Procedure updatelist()
|
||||
ClearGadgetItems(ListView_0)
|
||||
If DatabaseQuery(0, "SELECT * FROM kratom")
|
||||
While NextDatabaseRow(0) ; Loop for each records
|
||||
;Debug GetDatabaseString(#Database, 0) ; Display the content of the first field
|
||||
AddGadgetItem (ListView_0, -1, "Name " + GetDatabaseString(0,1) + " Type " + GetDatabaseString(0,2))
|
||||
Wend
|
||||
EndIf
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure dellist(EventType)
|
||||
; I might need this
|
||||
selecteditem = GetGadgetState(ListView_0)
|
||||
selectedname$ = GetGadgetItemText(ListView_0,selecteditem)
|
||||
RemoveGadgetItem(ListView_0,GetGadgetState(ListView_0)) ; removes it from view
|
||||
fldname$ = StringField(selectedname$,2," ")
|
||||
|
||||
;Debug fldname$
|
||||
;Debug DatabaseUpdate(0, "DELETE FROM kratom WHERE name = '"+fldname$+"';")
|
||||
;Debug DatabaseError()
|
||||
;If DatabaseQuery(0, "DELETE FROM * kratom WHERE name = '"+fldname$+"';")
|
||||
;While NextDatabaseRow(0) ; Loop for each records
|
||||
;Debug GetDatabaseString(#Database, 0) ; Display the content of the first field
|
||||
; AddGadgetItem (ListView_0, -1, "Name " + GetDatabaseString(0,1) + " Type " + GetDatabaseString(0,2))
|
||||
;Wend
|
||||
;EndIf
|
||||
EndProcedure
|
||||
|
||||
; window init
|
||||
|
||||
updatelist()
|
||||
|
||||
|
||||
AddGadgetItem (ListView_0, -1, "Item " + Str(a) + " of the Listview")
|
||||
;AddGadgetItem (ListView_0, -1, "Item " + Str(a) + " of the Listview")
|
||||
|
||||
HideWindow(krt1,#False)
|
||||
|
||||
|
@ -40,8 +77,9 @@ Repeat
|
|||
EndSelect
|
||||
|
||||
Until Event = #PB_Event_CloseWindow ; Quit on any window close
|
||||
|
||||
; IDE Options = PureBasic 6.12 LTS (Linux - x64)
|
||||
; CursorPosition = 21
|
||||
; CursorPosition = 47
|
||||
; FirstLine = 24
|
||||
; Folding = -
|
||||
; EnableXP
|
||||
; DPIAware
|
|
@ -1,4 +1,7 @@
|
|||
;
|
||||
; Form Designer for PureBasic - 6.12
|
||||
; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again.
|
||||
|
||||
;
|
||||
; This code is automatically generated by the Form Designer.
|
||||
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
|
||||
; Event procedures need to be put in another source file.
|
||||
|
@ -6,20 +9,24 @@
|
|||
|
||||
Global krt1
|
||||
|
||||
Global Container_0, ListView_0, Text_0, Text_1, String_0, Button_0, Button_1, Button_2
|
||||
Global Container_0, ListView_0, Text_0, Text_1, String_0, Button_0, Button_1, Button_2, String_1, Text_2
|
||||
|
||||
Declare dellist(EventType)
|
||||
Declare btn0click(EventType)
|
||||
|
||||
Procedure Openkrt1(x = 0, y = 0, width = 830, height = 570)
|
||||
Procedure Openkrt1(x = 0, y = 0, width = 920, height = 600)
|
||||
krt1 = OpenWindow(#PB_Any, x, y, width, height, "Kratom Picker GUI", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
|
||||
HideWindow(krt1, 1)
|
||||
Container_0 = ContainerGadget(#PB_Any, 10, 10, 810, 550)
|
||||
Container_0 = ContainerGadget(#PB_Any, 10, 10, 900, 580)
|
||||
ListView_0 = ListViewGadget(#PB_Any, 0, 60, 300, 470)
|
||||
Text_0 = TextGadget(#PB_Any, 70, 20, 130, 30, "Kratom Stock")
|
||||
Text_1 = TextGadget(#PB_Any, 310, 20, 170, 30, "Kratom to add")
|
||||
String_0 = StringGadget(#PB_Any, 460, 10, 150, 40, "")
|
||||
Button_0 = ButtonGadget(#PB_Any, 630, 10, 130, 40, "Add")
|
||||
Button_0 = ButtonGadget(#PB_Any, 680, 60, 130, 40, "Add")
|
||||
Button_1 = ButtonGadget(#PB_Any, 310, 60, 130, 40, "Burn!")
|
||||
Button_2 = ButtonGadget(#PB_Any, 310, 490, 130, 40, "Delete")
|
||||
String_1 = StringGadget(#PB_Any, 680, 10, 150, 40, "")
|
||||
Text_2 = TextGadget(#PB_Any, 620, 20, 50, 30, "Type")
|
||||
CloseGadgetList()
|
||||
EndProcedure
|
||||
|
||||
|
@ -34,14 +41,12 @@ Procedure krt1_Events(event)
|
|||
|
||||
Case #PB_Event_Gadget
|
||||
Select EventGadget()
|
||||
Case Button_0
|
||||
btn0click(EventType())
|
||||
Case Button_2
|
||||
dellist(EventType())
|
||||
EndSelect
|
||||
EndSelect
|
||||
ProcedureReturn #True
|
||||
EndProcedure
|
||||
|
||||
|
||||
; IDE Options = PureBasic 6.12 LTS (Linux - x64)
|
||||
; CursorPosition = 41
|
||||
; FirstLine = 7
|
||||
; Folding = -
|
||||
; EnableXP
|
|
@ -7,14 +7,23 @@
|
|||
<section name="data">
|
||||
<explorer view="/opt/purebasic/examples/" pattern="0"/>
|
||||
<log show="1"/>
|
||||
<lastopen date="2024-09-17 20:44" user="kake26" host="kake26-20l6s42e00"/>
|
||||
<lastopen date="2024-09-17 23:16" user="kake26" host="kake26-20l6s42e00"/>
|
||||
</section>
|
||||
<section name="files">
|
||||
<file name="kratom.pb">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="1" panelstate="+"/>
|
||||
<fingerprint md5="ab4f18ac51a4fe0d16c110460946fe9a"/>
|
||||
</file>
|
||||
<file name="kratomfrm1.pbf">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="2" panelstate="+"/>
|
||||
<fingerprint md5="31af23cf297f2016a8d18f51dc8faeff"/>
|
||||
</file>
|
||||
</section>
|
||||
<section name="files"/>
|
||||
<section name="targets">
|
||||
<target name="Default Target" enabled="1" default="1">
|
||||
<inputfile value=""/>
|
||||
<inputfile value="kratom.pb"/>
|
||||
<outputfile value=""/>
|
||||
<options xpskin="1" dpiaware="1" debug="1" optimizer="0"/>
|
||||
<options xpskin="1" dpiaware="1" debug="1" optimizer="1"/>
|
||||
</target>
|
||||
</section>
|
||||
</project>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue