Questions about Tweak and UI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about Tweak and UI

Phua Khai Fong


Hi guys,

    I am currently trying to build an application in croquet and I hope you guys can help me with some of the things I am not so clear about.
1) What is the meaning of the angle brackets '<' and '>' and when should it be used? I see it is mainly used to keep a method aware of an event but I'm not really sure bout that.
2)Where can I get a full list of the Tweak syntax and more information about it?I have browsed the treakproject.org site but its not really complete. I hope to get more examples and tutorials (besides the bank account tutorial).
3)I created a tree menu at the side using CTreeWidget. The problem is after I click on the tree menu, it steals the keyboard focus and the world doesn't respond to key events anymore ( it still responds to the mouse though). All key events are focused on the tree menu. How do I fix this problem?

Thanks for reading and have a nice day!!


Send instant messages to your online friends http://uk.messenger.yahoo.com
Reply | Threaded
Open this post in threaded view
|

Re: Questions about Tweak and UI

Andreas.Raab
Hi -

Phua Khai Fong wrote:
> 1) What is the meaning of the angle brackets '<' and '>' and when should
> it be used? I see it is mainly used to keep a method aware of an event
> but I'm not really sure bout that.

They should only be used for adding event triggers as in:

onMouseDown
   <on: mouseDown>

onButtonFire
   <on: fire in: button>

onClockTick
   <ticking: 5>

> 2)Where can I get a full list of the Tweak syntax and more information
> about it?I have browsed the treakproject.org site but its not really
> complete. I hope to get more examples and tutorials (besides the bank
> account tutorial).

Unfortunately, there are currently no other tutorials (and I'm not in a
position to write more). As far as syntax goes, besides the annotations
the only other change is that Tweak allows "remote assignments" for
clarity, e.g.,

   circle color := Color black.

(which gets transformed into a #color: message). For syntax, that's it.
Tweak uses some of the annotations internally (like the #bewareOf:
annotations) and you don't have to worry about these at all. The only
annotations that matter are the event triggers.

> 3)I created a tree menu at the side using CTreeWidget. The problem is
> after I click on the tree menu, it steals the keyboard focus and the
> world doesn't respond to key events anymore ( it still responds to the
> mouse though). All key events are focused on the tree menu. How do I fix
> this problem?

Not sure what you're trying to achieve but maybe you can just set the
keyboard focus to whatever you'd like after the mouse up event?

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Questions about Tweak and UI

Phua Khai Fong
I am back to solving problem 3 now, it was left alone for a while but becoming a crucial part now as the tree menu is used oftenly.

My problem is after clicking the tree view menu, the keyboardFocus is set to the tree and all key events will not be forwarded to the harness anymore. There is a releaseKeyboardFocus method in CTreeWidgetCostume which gets called in the method onMouseLeave but it just seems to release the focus. How do I set the keyboard focus back to the harness so that key events can be forwarded to the harness again?

Andreas Raab wrote
Hi -

Phua Khai Fong wrote:
> 1) What is the meaning of the angle brackets '<' and '>' and when should
> it be used? I see it is mainly used to keep a method aware of an event
> but I'm not really sure bout that.

They should only be used for adding event triggers as in:

onMouseDown
   <on: mouseDown>

onButtonFire
   <on: fire in: button>

onClockTick
   <ticking: 5>

> 2)Where can I get a full list of the Tweak syntax and more information
> about it?I have browsed the treakproject.org site but its not really
> complete. I hope to get more examples and tutorials (besides the bank
> account tutorial).

Unfortunately, there are currently no other tutorials (and I'm not in a
position to write more). As far as syntax goes, besides the annotations
the only other change is that Tweak allows "remote assignments" for
clarity, e.g.,

   circle color := Color black.

(which gets transformed into a #color: message). For syntax, that's it.
Tweak uses some of the annotations internally (like the #bewareOf:
annotations) and you don't have to worry about these at all. The only
annotations that matter are the event triggers.

> 3)I created a tree menu at the side using CTreeWidget. The problem is
> after I click on the tree menu, it steals the keyboard focus and the
> world doesn't respond to key events anymore ( it still responds to the
> mouse though). All key events are focused on the tree menu. How do I fix
> this problem?

Not sure what you're trying to achieve but maybe you can just set the
keyboard focus to whatever you'd like after the mouse up event?

Cheers,
   - Andreas
Reply | Threaded
Open this post in threaded view
|

Re: Questions about Tweak and UI

Phua Khai Fong
I have solved this problem by overwriting mouseDown: method in my world class and in that class, pass the mouseDown: to super (so that it is then passed to the harness ) and then force the hand to release the keyboard focus on the tree menu. The keyboard events are now picked up by the world even after clicking on the tree view menu.

The whole method :-

mouseDown: evt

        super mouseDown: evt.
        evt hand releaseKeyboardFocus: harness treeMenu.