New Problem
Posted: Sat Sep 21, 2024 8:27 pm
Continue to develop the aplication and as I go new problems appear.
In this code The window open but does not show the ListIconGadget. It stays opened with the hourglass as if it was doing something.
Can anyone help me find the problem?
I don't know how to attach a file so I can send the database
Thank You
In this code The window open but does not show the ListIconGadget. It stays opened with the hourglass as if it was doing something.
Code: Select all
Enumeration FormWindow
#ArtigosWindow
#DB
EndEnumeration
Enumeration FormGadget
#ArtigosList
#But_Artigo_Delete
#But_artigo_Select
#But_Cancel_Artigo_list
EndEnumeration
Procedure DeleteArtigo()
NumeroArtigos = CountGadgetItems(#ArtigosList)
For i = 0 To NumeroArtigos
GetGadgetItemState(#ArtigosList, i)
If #PB_Tree_Checked
RemoveGadgetItem(#ArtigosList, i)
EndIf
Next
EndProcedure
Procedure FillArtigosList()
DatabaseFile$ = "Facturacao.sqlite"
UseSQLiteDatabase()
If Not OpenDatabase(#DB, DatabaseFile$, "", "")
MessageRequester("ERROR", "Can't open " + DatabaseFile$)
End
EndIf
SQL.s = "SELECT * FROM Artigos"
ClearGadgetItems(#ArtigosList)
If DatabaseQuery(#DB, SQL)
While NextDatabaseRow(#DB)
CodigoArtigo.s = GetDatabaseString(#DB, 0)
Descricao.s = GetDatabaseString(#DB, 1)
PVP.i = GetDatabaseQuad(#DB, 7)
AddGadgetItem(#ArtigosList, -1, CodigoArtigo + Chr(10) + Descricao + Chr(10) + PVP)
Wend
FinishDatabaseQuery(#DB)
EndIf
CloseDatabase(#DB)
SetGadgetState(#ArtigosList, 0)
EndProcedure
OpenWindow(#ArtigosWindow, 0, 0, 1040, 500, "Artigos", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ListIconGadget(#ArtigosList, 20, 20, 1000, 400, "Codigo", 150, #PB_ListIcon_CheckBoxes!#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
AddGadgetColumn(#ArtigosList, 1, "Descrição", 696)
AddGadgetColumn(#ArtigosList, 2, "PVP", 150)
ButtonGadget(#But_Artigo_Delete, 800, 440, 100, 30, "Delete")
ButtonGadget(#But_Cancel_Artigo_list, 680, 440, 100, 30, "Cancel")
ButtonGadget(#But_artigo_Select, 920, 440, 100, 30, "Select")
FillArtigosList()
Event = WaitWindowEvent()
If event = #PB_Event_Gadget
If EventGadget() = #But_Artigo_Delete
DeleteArtigo()
ElseIf EventGadget() = #But_Cancel_Artigo_List
Event = #PB_Event_CloseWindow
ElseIf EventGadget() = #But_artigo_Select
; LimparFormArtigo()
EndIf
EndIf
Repeat
Until Event = #PB_Event_CloseWindow
I don't know how to attach a file so I can send the database
Thank You