save point
This commit is contained in:
parent
1195f20ffb
commit
08ef995805
4 changed files with 71 additions and 19 deletions
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
|
Loading…
Add table
Add a link
Reference in a new issue