Yes I want to extend TGadget to hold getting more information about other gadgets. TProxyGadget ? humm it's in MaxGUI ?
Yep - have a look in
brl.mod/maxgui.mod/gadget.bmx. Basically, it's something Skidracer added to allow you to easily extend TGadget to create custom gadgets etc.
Here's a quick demo:
SuperStrict
Global myInfoWins:TInfoWin[5]
'Let's create some TInfoWin s
For Local i% = 0 Until myInfoWins.length
myInfoWins[i] = CreateInfoWindow( "Window " + i, 50+40*i, 50+20*i, 200, 150, Null, WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS|WINDOW_TOOL)
myInfoWins[i].myInfoText = "Random fact " + i
Next
CreateTimer 1
Repeat
Select WaitEvent()
Case EVENT_APPTERMINATE;End
Case EVENT_TIMERTICK
For Local tmpInfoWin:TInfoWin = EachIn myInfoWins
'You can use them just like normal gadgets, except you can also access your extended fields
SetGadgetText tmpInfoWin, tmpInfoWin.myInfoText + " (" + CurrentTime() + ")"
Next
Case EVENT_WINDOWCLOSE;End
EndSelect
Forever
'TInfoWin Custom Declarations
Type TInfoWin Extends TProxyGadget
Field myInfoText$
EndType
Function CreateInfoWindow:TInfoWin( pTitle$, pX%, pY%, pW%, pH%, pParent:TGadget = Null, pStyle% = 15 )
Local tmpWindow:TGadget = CreateWindow(pTitle, pX, pY, pW, pH, pParent, pStyle)
Local tmpInfoWin:TInfoWin = New TInfoWin
tmpInfoWin.SetProxy tmpWindow 'We tell the type instance, which gadget it is to represent
Return tmpInfoWin
EndFunction