GadgetParent()

BlitzPlus Forums/BlitzPlus Programming/GadgetParent()

JoshK(Posted 2005) [#1]
Man, I rule so much...

Function GetGadgetParent(gadget)
Return PeekL(gadget+28)
End Function

Function GadgetParent(gadget,parent)
SetParent QueryObject(gadget,1),QueryObject(parent,1)
PokeL gadget+28,parent
End Function


sswift(Posted 2005) [#2]
Or you could just stick this in user32.decls:
GetParent%(hwnd%)

And call this function:
Function GetGadgetParent(Gadget)
   Return GetParent(QueryObject(Gadget, 1))
End Function

But you rule too much to do that. :-)


JoshK(Posted 2005) [#3]
That doesn't return the Blitz gadget, dumbass.


Qube(Posted 2005) [#4]
lol, nothing is so much fun as halo vs sswift in a handbags at dawn spit for spat..


sswift(Posted 2005) [#5]
Yeah, I guess I am a dumbass. I misinterpreted what you wanted to do. Sorry!

What I should have said was:

Why do all that when you can just use the GadgetGroup() command?

GadgetGroup(gadget)
Parameters
gadget - A gadget handle  

Description
GadgetGroup returns the group the gadget belongs to - ie: its 'parent' gadget.


Dumbass. :-)


WolRon(Posted 2005) [#6]
Oh, the irony is killing me....


Tracer(Posted 2005) [#7]
Sswift, you ow me a new keyboard.. got coke all over it now..

Tracer


Wiebo(Posted 2005) [#8]
.


JoshK(Posted 2005) [#9]
Has that command always been there?

ANyways, this will set the parent:
Function SetGadgetGroup(gadget,parent)
SetParent QueryObject(gadget,1),QueryObject(parent,1)
PokeL gadget+28,parent
End Function

Just make sure you restore it befgore closing the program.


Wiebo(Posted 2005) [#10]
I think GradgetGroup is rather new. Where does your SetParent function come from!?


JoshK(Posted 2005) [#11]
That's what I thought.

SetParent is in user32.dll.