Page 1 of 1

Imagegadget is no gadget?

Posted: Tue Feb 07, 2012 6:28 pm
by jesperbrannmark
This happens when i do a frame3dgadget. I found this out the hard way, though life.
Click first black thing = works
Click second black thing = not work

Can someone confirm? Workaround?

Code: Select all

OpenWindow(0,0,0,500,500,"")
Frame3DGadget(0,100,100,300,300,"")
CreateImage(0,50,50)
ButtonImageGadget(1,120,120,50,50,ImageID(0))
ImageGadget(2,200,120,50,50,ImageID (0))
Repeat
  If WaitWindowEvent()=#PB_Event_Gadget
    Debug "EVENTGADGET"
  EndIf
ForEver

Re: Imagegadget is no gadget?

Posted: Tue Feb 07, 2012 7:16 pm
by WilliamL
Yup, it does the same thing here in Snow Leopard. Wierd Take out the Frame3DGadget and it works fine. Looks like a bug to me.

Yes, you can waste a lot of time on something like this.

Re: Imagegadget is no gadget?

Posted: Wed Feb 08, 2012 6:06 pm
by Shardik
jesperbrannmark wrote:Workaround?

Code: Select all

ImportC ""
  NewControlUserPaneHitTestUPP(ControlUserPaneActivateCallback.L)
  SetControlData(ControlRef.L, ControlPartCode.W, TagName.L, BufferSize.L, *Buffer)
EndImport

#kControlUserPaneHitTestProcTag = $68697474 ; 'hitt'

ProcedureC UserPaneHitTestCallback(ControlRef.L, Point.L)
  Debug "Click onto ImageGadget"
EndProcedure

OpenWindow(0,270,100,500,500,"")
Frame3DGadget(0,100,100,300,300,"")
CreateImage(0,50,50)
ButtonImageGadget(1,120,120,50,50,ImageID(0))
ImageGadget(2,200,120,50,50,ImageID(0))

UserPaneHitTestUPP = NewControlUserPaneHitTestUPP(@UserPaneHitTestCallback())
SetControlData(GadgetID(2), 0, #kControlUserPaneHitTestProcTag, 4, @UserPaneHitTestUPP)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      Debug "Click onto Gadget #" + Str(EventGadget())
  EndSelect
ForEver

Re: Imagegadget is no gadget?

Posted: Wed Feb 08, 2012 6:31 pm
by jesperbrannmark
You are like a high priest :D
I wish I had the knowledge to understood your code, anyhow.. it works.

J