a cross-compatible interface-object based on canvas-gadget

Mac OSX specific forum
delikanli_19_82
User
User
Posts: 38
Joined: Tue Jun 21, 2011 6:11 pm

a cross-compatible interface-object based on canvas-gadget

Post by delikanli_19_82 »

hello guys,

i published for a while this bug about the canvas-gadget on mac:

http://www.purebasic.fr/english/viewtop ... 24&t=46693

The answer is good, but not really helpful in the new situation:

I wrote a simple interface-object, which covers the canvas-gadget to interact with it like an object. You have methods like Enabled(), Visible(), Left(), Top(), Width(), Height() etc.

Now the object shell react to all events like the canvas-gadget. The problem here is, that on mac, the mouseleave event does not fire.

The interface-object allows you to connect to each event "which you want to use", an external parameterless procedure or you can react to each event by a Select-Statement.

In this case Shardiks code cannot help me directly. i tried several workarounds without success.

Here a pseudo-sample code:

Code: Select all


XInclude ...

Define ev.l

OpenWindow( #window, ... )

Define newobj.my_object = my_object()

newobj\ConnectEvent( #mouse_over, @MyObject_MouseOver() )
newobj\ConnectEvent( #mouse_out,  @MyObject_MouseOut() )

Repeat

  ev = WaitWindowEvent()

  Select newobj\EvaluateEvent( ev )
     Case #mouse_down: Debug "Down"
     Case #mouse_up: Debug "Up"
  EndSelect

Until ev = #PB_Event_CloseWindow

As you can see, I connect an external Procedure to a specific event of the instance. But if I try this, it will not work clearly:

Code: Select all


XInclude ...

Define ev.l

OpenWindow( #window, ... )

; INSTANCE >> OBJ_A

Define obj_a.my_object = my_object()

obj_a\ConnectEvent( #mouse_over, @Object_A_MouseOver() )
obj_a\ConnectEvent( #mouse_out,  @Object_A_MouseOut() )

; INSTANCE >> OBJ_B

Define obj_b.my_object = my_object()

obj_b\ConnectEvent( #mouse_over, @Object_B_MouseOver() )
obj_b\ConnectEvent( #mouse_out,  @Object_B_MouseOut() )

Repeat

  ev = WaitWindowEvent()

  Select obj_a\EvaluateEvent( ev )
     Case #mouse_down: Debug "A Down"
     Case #mouse_up: Debug "A Up"
  EndSelect

  Select obj_a\EvaluateEvent( ev )
     Case #mouse_down: Debug "B Down"
     Case #mouse_up: Debug "B Up"
  EndSelect

Until ev = #PB_Event_CloseWindow

The goal is that the usage of the interface-object have to be in the same way on all three os win, lin and mac.
That means, i cannot make an exception to mac. i have to solve it in a way, so that the object itself have to work on all three os in the same way from the point of view of the programmer.

can someone help me?

kind regards

:-)