Page 1 of 1

Window, Gadget problem

Posted: Sat Oct 30, 2004 3:30 pm
by robink
This normally should make a window with a button in it:

Code: Select all

If OpenWindow(0, 0, 0, 320, 240, #PB_Window_ScreenCentered|#PB_Window_MinimizeGadget, "") = 0
	End
EndIF 

If CreateGadgetList(0) = 0
	End
EndIF 

ButtonGadget(0, 0, 0, 200, 20, "Test")

Repeat
	Delay(10)
Until WaitWindowEvent() = #PB_Event_CloseWindow
But i only see a grey window here, and in the console i get this output:

Code: Select all

Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkObject'

Gtk-CRITICAL **: file gtkobject.c: line 1079 (gtk_object_get_data): assertion `object != NULL' failed.

Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkContainer'

Gtk-CRITICAL **: file gtkcontainer.c: line 1118 (gtk_container_foreach): assertion `container != NULL' failed.

Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkBox'

Gtk-CRITICAL **: file gtkbox.c: line 329 (gtk_box_pack_start): assertion `box != NULL' failed.

Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkObject'

Gtk-CRITICAL **: file gtkobject.c: line 1033 (gtk_object_set_data): assertion `object != NULL' failed.
gtk-dev is installed, and i am using pb 3.91 on Debian testing/unstable.

Posted: Sat Oct 30, 2004 4:22 pm
by Beach
Change "CreateGadgetList(0)" to "CreateGadgetList(WindowID(0))"

This worked for me using CoLinux/Gentoo

Posted: Sun Oct 31, 2004 9:00 am
by robink
Oh, ok i didn't program in PureBasic for a too long time :)
Another problem, DarkDragon gave me a little program (an
IRC bot), that uses the ListViewGadget with 6 parameters
instead of 5, something like this:

Code: Select all

If OpenWindow(0, 0, 0, 320, 240, #PB_Window_ScreenCentered|#PB_Window_MinimizeGadget, "") = 0
   End
EndIF

If CreateGadgetList(WindowID(0)) = 0
   End
EndIF

ListViewGadget(0, 0, 0, 320, 240, "")

Repeat
   Delay(10)
Until WaitWindowEvent() = #PB_Event_CloseWindow
When i try to compile to compile it , the compile doesn't say
that it is a unknow function, array or list, i only get this
message:

Code: Select all

******************************************
PureBasic Linux x86 v3.91
******************************************

Loading external modules...
Starting compilation...
14 lines processed.
Creating the executable.
purebasic.o(.text+0xa2): In function `main':
: undefined reference to `PB_ListViewGadget2'
collect2: ld returned 1 exit status

- Feel the ..PuRe.. Power -

sh: line 1: ./purebasic.exe: No such file or directory

Posted: Sun Oct 31, 2004 12:01 pm
by freak
The ListIconGadget doesn't have any supported Flags in PB. However, the
optional last parameter was added in Windows, so you could easily stick
some WinAPI constants in there.

Since those don't work on Linux anyway, there is no such extra parameter there.

So just remove those flags in the last parameter.

Posted: Thu Nov 04, 2004 6:42 pm
by robink
Hi,
ok thank you for that informations, maybe it
would be better if the compiler would give a
better error message likle "Too many parameters"
so it's easier to understand :wink:

Posted: Fri Nov 05, 2004 12:14 pm
by freak
Looking at it again, i think you are right.

I think the intention was to allow a flags parameter but simply to ignore it.
Seems like the function for a call with 'Flags' is missing here though.
Fred'll have to correct that.

Posted: Fri Nov 05, 2004 12:22 pm
by Fred
I will fix it.