how to determine the "class" of a given gadget

BlitzMax Forums/BlitzMax Beginners Area/how to determine the "class" of a given gadget

Hello!

How do I determine the "class" of a given gadget ("gadgetclass", to use a term used by the maxgui_driver)? There is a list of constants in gadget.bmx, but there does not seem to be any field within a gadget which could be used to find out, what kind of gadget a given one is.

Does anybody have any idea?

I'm not sure how to do it (or even if it can be done). The MaxGui OO is a bit poor although I did have a look at this as a wrapper.

Tony,

"wrapping" is just what I am doing as well ;-)
Seems as if I would have to track the object class myself, hoping that nobody will create TGadget instances without using my wrapper...

Thanks anyway!

Id start with this, and work my way to something that works on all platforms:
Function GadgetClass:Int( gadget:TGadget)
?Win32
	Return TWin32Gadget(gadget).Class
?MacOS
	Return TNSGadget(gadget).Class
?Linux
	Select TFLWidget(gadget).FLType
		Case FL_WINDOW
			Return GADGET_WINDOW
		Case FL_BUTTON, FL_CHECKBUTTON, FL_ROUNDBUTTON
			Return GADGET_BUTTON
		Case FL_PANEL, FL_GROUP
			Return GADGET_PANEL
		Case FL_INPUT, FL_PASSWORD
			Return GADGET_TEXTFIELD
		Case FL_TABS
			Return GADGET_TABBER
		Case FL_BROWSER
			Return GADGET_HTMLVIEW
		Case FL_CHOICE
			Return GADGET_COMBOBOX
		Case FL_TEXTEDITOR
			Return GADGET_TEXTAREA
		Case FL_TEXTDISPLAY
			Return GADGET_LABEL
		Case FL_TOOLBAR
			Return GADGET_TOOLBAR
		Case FL_PROGBAR
			Return GADGET_PROGBAR
		Case FL_SLIDER, FL_SCROLLBAR
			Return GADGET_SLIDER
		Case FL_CANVAS
			Return GADGET_CANVAS
		Case FL_MENUITEM
			Return GADGET_MENUITEM
		Case FL_DESKTOP
			Return GADGET_DESKTOP
		Case FL_TIMER
			Return GADGET_TIMER
		
		' i dont know, need linux to test
		'Case FL_HELPVIEW, FL_BOX, FL_MENUBAR, FL_PACK
			
		Default
			Return -1
	EndSelect
?
EndFunction

This may brake in the future though.

Great!

Thanks!