Gui

Blitz3D Forums/Blitz3D Programming/Gui

David819(Posted 2005) [#1]
Hi, i'm trying to make a gui system but have a question, how do i add an id to a window because when you use a function to create a window you tend to use something like
W.Win = New Win
then you have the code for creating it but if i then tested it to create more that one window and make a function to add say a button to one window how would i add referance to the window i want to add it to?


Shifty Geezer(Posted 2005) [#2]
Add a reference number field in the Win type.


David819(Posted 2005) [#3]
ok but what then, if i want to call it up i need to use something like if
W\Ref = Reference then
*what ever is wanted*
endif
but how does that add a direct link to a window, like say i wanted to code the window to be able to be moved around with the mouse, i would need to be able to get the window that the mouse is over to be identified seperate from the others and then changed the properties inside the functions that created that window without affecting the others.


Techlord(Posted 2005) [#4]
Goober,

I use one Type for all gizmos. As Shifty Geezer has suggested you can add a ID field to the Type. I would go a step further by adding a Array of Types to store a pointer to the gizmos by ID. This will allow you to access properties of individual gizmos by ID.

Heres an excerpt of code from MAUI. For example purposes only:)



Now you can create and access gizmos individually by ID. Whats really cool about this method is that there are variety of ways you can manage ID assignment. For example you can use a stack to push and pop IDs to recycle IDs. Very good for gizmos that are constant created and deleted. Anyhows...




David819(Posted 2005) [#5]
This method sort of makes sense but it's a bit blurry to understand, can you please explain it in a simpler way if possible, mean while i will try and addapt your idea to my coding.
thanks


octothorpe(Posted 2005) [#6]
Can you explain your question/problem in simpler terms? I don't understand.


Rook Zimbabwe(Posted 2005) [#7]
I see what he means... for each instance of GUI control or objects you create a new TYPE. I suggest a read through on TYPEs here: http://www.blitzbasic.com/Community/posts.php?topic=34757

And a general rummage through the TUTORIALS section would not be too out of hand as a reccomend as well.

RZ