Page 1 of 1

Weird #Gadget error

Posted: Fri Nov 02, 2007 6:32 pm
by Rook Zimbabwe
OK more into my program.
I am reading a DB file to get the text to assign to a button. The problem is that when I attempt to apply the text I get a:
ERROR #Gadget object not initialized

Now in order for you to press this button and rename the text on all the other buttons the window that HAS the other buttons IS open... As far as I know they are initialized.

Code: Select all

Procedure Button_SEL0_Event(Window, Event, Gadget, Type)
  b = 0
    frag$ = GetGadgetText(#Button_SEL0) ; what table name (same as text of button)
    Debug frag$
      DatabaseQuery(#Database, "SELECT * FROM "+frag$+"';") ;
        For b = 0 To 24
          but$=GetDatabaseString(#Database, 1) ; FOOD COLUMN
          Debug but$ ; **** This lists all names correctly!!!
            SetGadgetText(#Button_IT0+b,but$ ) ; **** ERROR HERE
              NextDatabaseRow(#Database) 
        Next
  b=0
EndProcedure
There are even exactly 25 records in that table

Posted: Fri Nov 02, 2007 6:39 pm
by Trond
As far as I know they are initialized.
If you get that error, then basically they aren't.

Posted: Fri Nov 02, 2007 6:51 pm
by srod
Stick a If IsGadget(...) into the loop and perhaps a 'debug b' and you should quickly see which gadgets are and are not initialised.

Posted: Fri Nov 02, 2007 6:52 pm
by Rook Zimbabwe
This is a Declare issue!!!
I am sure of it. I am trying to learn to work within the new syntax generated by the design tool... you know... every button a procedure etc... I am sure this is a declare issue!
{EDIT}
Maybe not...

I stuck a isgadget into the procedure... It appears that 6 of these buttons are NOT in existece even though the window has opened and intitialized... and the procedures for all 25 buttons work... Hmm

Posted: Fri Nov 02, 2007 10:26 pm
by dontmailme
Maybe you could post the code that initialises the buttons ? :)

Posted: Fri Nov 02, 2007 11:06 pm
by Sparkie
I can't tell from the code but are you dealing with 2 different Windows/GadgetLists :?:

*Edit* Nevermind...I was off in my thinking. :wink:

Posted: Sat Nov 03, 2007 2:55 am
by Rook Zimbabwe
Code examples posted in thread: http://www.purebasic.fr/english/viewtopic.php?t=29398

Since this is related

Posted: Sat Nov 03, 2007 3:56 am
by Sparkie