If starting from ground zero I would say go with one nested type array for the whole project, a base gui >> windows >> gadgets that way your inheritance is sorted from the get-go you just need to write a good depth buffer system to handle focus but that should not be to hard, you was heading in the right direction in your gui project the base code is already there.
I, like yourself, went with a separate global for each object which I now see as a mistake and may start again .... << and there's the reason why nothing ever gets finished, to dam pedantic!!
Quote: "We could start from scratch together ?"
I could possibly take you up on that, if we could agree a base system and implement a gadget type switch system I'm sure we could both write code for gadgets and include them like modules
a quick air-code example
Type tGUI_Button
id
x
y
width
height
sprite_id
text_id
text as string
icon_id
toggle
state
EndType
Type tGUI_Slider
id
x
y
width
height
bar_id
slider_id
range_min
range_max
cur_pos
EndType
Type tGUI_ListBox_Item
back_id
text_id
icon_id
data
text as string
EndType
Type tGUI_ListBox
id
x
y
width
height
cur_sel
item as tGUI_ListBox_Item
EndType
Type tGUI_Window
title as string
window_id
title_id
title_text_id
title_icon_id
client_id
// add gadgets here
button as tGUI_Button[]
slider as tGUI_Slider[]
listbox as tGUI_ListBox[]
// add more gadgets here
EndType
Type tGUI
active_window
width
height
title as string
window as tGUI_Window
EndType
Global tGUI as tGUI
// Add gadget type constant
#Constant GADGET_TYPE_BUTTON 1
#Constant GADGET_TYPE_SLIDER 2
#Constant GADGET_TYPE_LISTBOX 3
// creation functions
Function GUI_CreateWindow(window_id, x, y, width, height, title as string, parent)
gGUI.active_window=window_id
tmp_window as tGUI_Window
tmp_window.window_id=window_id
if window_id<>-1
tmp_window.title_id=CreateSprite(0)
tmp_window.title_icon_id=CreateSprite(0)
tmp_window.title_text_id=CreateText(0)
tmp_window.client_id=CreateSprite(0)
endif
EndFunction
Function GUI_CreateButton(gadget_id, x, y, width, height, text as string, parent)
tmp_button as tGUI_Button
gGUI.window[gGUI.active_window].button.insert(tmp_button)
EndFunction
Function GUI_CreateSlider(gadget_id, x, y, width, height, min, max, current, parent)
tmp_slider as tGUI_Slider
gGUI.window[gGUI.active_window].slider.insert(tmp_slider)
EndFunction
Function GUI_CreateListBox(gadget_id, x, y, width, height, parent)
tmp_listbox as tGUI_ListBox
gGUI.window[gGUI.active_window].listbox.insert(tmp_listbox)
EndFunction
//Get/Set Functions
// button
Function GUI_GetButtonText(bla, some, vars)
EndFunction
Function GUI_GetButtonState(bla, some, vars)
EndFunction
// Slider
Function GUI_GetSliderPos(bla, some, vars)
EndFunction
Function GUI_GetSliderText(bla, some, vars)
EndFunction
//Listbox
Function GUI_GetListBoxSelected(bla, some, vars)
EndFunction
Function GUI_GetListBoxSelectedText(bla, some, vars)
EndFunction
// Main GUI virtual functions
Function GetGadgetState(gadget_id)
// find the gadget id in the main gui array and select its type
Select gadget_type
Case GADGET_TYPE_BUTTON
ExitFunction GUI_GetButtonState(bla, some, vars)
EndCase
Case GADGET_TYPE_SLIDER
ExitFunction GUI_GetSliderPos(bla, some, vars)
EndCase
Case GADGET_TYPE_LISTBOX
ExitFunction GUI_GetListBoxSelected(bla, some, vars)
EndCase
EndSelect
EndFunction
Function GetGadgetText(gadget_id)
// find the gadget id in the main gui array and select its type
Select gadget_type
Case GADGET_TYPE_BUTTON
ExitFunction GUI_GetButtonText(bla, some, vars)
EndCase
Case GADGET_TYPE_SLIDER
ExitFunction GUI_GetSliderText(bla, some, vars)
EndCase
Case GADGET_TYPE_LISTBOX
ExitFunction GUI_GetListBoxSelectedText(bla, some, vars)
EndCase
EndSelect
EndFunction