Hi,
I've just started using PureBasic and am having a problem with adding strings to a ListViewGadget.
.
. other gadgets made here
.
ListViewGadget(08,100, PanelH.w+50, 250, 050) creates the gadget.
AddGadgetItem(8,0,"fred")
The gadget appears on my display and the following line adds "fred" to it.
The same line will not work when called from with a procedure.
The debugger reports "#Gdget object not initialised"
Have I overlooked something obvious?
RichardL
AddGadgetItem() Problem
-
GreenGiant
- Enthusiast

- Posts: 252
- Joined: Fri Feb 20, 2004 5:43 pm
Its probably some fault in your code somewhere as it seems to work for me. Try this code
Thats working for me, so I'd guess you've made a mistake in yours. If you post the code people will try to help spot the problem for you.
Code: Select all
Procedure Proc()
AddGadgetItem(8,-1,"Dum de dum dum")
EndProcedure
OpenWindow(0,0,0,400,400,#PB_Window_SystemMenu | #PB_Window_ScreenCentered,"test")
CreateGadgetList(WindowID(0))
ListViewGadget(8,10,10,380,350)
ButtonGadget(0,10,370,380,20,"Press this")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
If EventGadgetID()=0
Proc()
EndIf
EndIf
Until ev=#PB_Event_CloseWindowIt was obvious after all...
I had a call that wrote to the ListViewGadget inside my initialising code and that ran before the gadgets were created. Sorry to waste your time!
Lack of coffer error in this morning.
However, it does throw up another problem:
How do I assign a non-proportional font to the gadget without using an API call... I'm specifically tryng to acheive a finished program without API calls and have almost finished. I want my nicely formatted data to appear in columns.
RicahrdL
I had a call that wrote to the ListViewGadget inside my initialising code and that ran before the gadgets were created. Sorry to waste your time!
Lack of coffer error in this morning.
However, it does throw up another problem:
How do I assign a non-proportional font to the gadget without using an API call... I'm specifically tryng to acheive a finished program without API calls and have almost finished. I want my nicely formatted data to appear in columns.
RicahrdL
How do I assign a non-proportional font to the gadget without using an API call
Code: Select all
Procedure Proc()
AddGadgetItem(8,-1,"Dum de dum dum")
EndProcedure
OpenWindow(0,0,0,400,400,#PB_Window_SystemMenu | #PB_Window_ScreenCentered,"test")
CreateGadgetList(WindowID(0))
ListViewGadget(8,10,10,380,350)
SetGadgetFont(8, LoadFont(1, "Courier", 10))
ButtonGadget(0,10,370,380,20,"Press this")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
If EventGadgetID()=0
Proc()
EndIf
EndIf
Until ev=#PB_Event_CloseWindow

