Window, Gadget problem

Linux specific forum
robink
User
User
Posts: 26
Joined: Sat Jan 03, 2004 7:25 pm
Location: Rinteln
Contact:

Window, Gadget problem

Post 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.
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

Change "CreateGadgetList(0)" to "CreateGadgetList(WindowID(0))"

This worked for me using CoLinux/Gentoo
-Beach
robink
User
User
Posts: 26
Joined: Sat Jan 03, 2004 7:25 pm
Location: Rinteln
Contact:

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5944
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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.
quidquid Latine dictum sit altum videtur
robink
User
User
Posts: 26
Joined: Sat Jan 03, 2004 7:25 pm
Location: Rinteln
Contact:

Post 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:
freak
PureBasic Team
PureBasic Team
Posts: 5944
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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.
quidquid Latine dictum sit altum videtur
Fred
Administrator
Administrator
Posts: 18254
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I will fix it.
Post Reply