Conseils for develop a grid

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

Re: Conseils for develop a grid

gerard alis
Exists the posibility of load data in another thread? When i try that get a huge rectangle red with a yellow cross. Is possible attach the UI from another thread?

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Conseils for develop a grid

David T. Lewis
On Sun, Feb 07, 2010 at 09:56:54AM -0800, nullPointer wrote:
>
> Exists the posibility of load data in another thread? When i try that get a
> huge rectangle red with a yellow cross. Is possible attach the UI from
> another thread?

Yes you can use another thread (Process). But when that process does
something with the user interface, it must be synchronized using
#addDeferredUIMessage: otherwise you will have error like the red X.

Your data loading thread can do something like this:

   WorldState addDeferredUIMessage: ['this is my data' inspect]

Dave


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Force the focus of a panel for start to listen key press events.

gerard alis
In reply to this post by gerard alis
Well, I decided let the optimization and threads load for later, my knowledge is poor, and see that very complicated :|

Now my main problem is the navigation through cells of grid. All cells have a "value control" (currently a label) where is viewed the value data. I need when a TAB key is pressed the current cell pass to next cell.

My question:

-How I can "focus" morph (the cell) for begin to listen the key presses events? that morph is really only a PanelMorph subclass. Really I understand than need the behavior of list widgets or textboxes for that cell, force the focus of some way.

Regards and thanks for the answers.
Reply | Threaded
Open this post in threaded view
|

Re: Force the focus of a panel for start to listen keypress events.

Gary Chambers-4
There are a few methods involved in making this happen and some will vary
depending on how you want things to look like...

#takesKeyboardFocus

        (should return true)

#handlesKeyboard: event

        (should return true or true for specific keys required

#keyStroke: event
 "Process keys navigation."

 self navigationKey: event

    (calls Polymorph navigation key handling)

#keyboardFocusChange: aBoolean
 "The message is sent to a morph when its keyboard focus changes.
 Update for focus feedback."

 self focusChanged

        (update focus indication rendering)

#drawSubmorphsOn: aCanvas
 "Display submorphs back to front.
 Draw the focus here since we are using inset bounds
 for the focus rectangle."

 super drawSubmorphsOn: aCanvas.
 self hasKeyboardFocus ifTrue: [self drawKeyboardFocusOn: aCanvas]

        (draw keyboard focus indication using theme defaults, guess you may
omit this and just do your "selection" thing in #keyboardFocusChange:)


Hope this helps!

Regards, Gary

----- Original Message -----
From: "nullPointer" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, February 09, 2010 10:23 PM
Subject: [Pharo-project] Force the focus of a panel for start to listen
keypress events.


>
> Well, I decided let the optimization and threads load for later, my
> knowledge
> is poor, and see that very complicated :|
>
> Now my main problem is the navigation through cells of grid. All cells
> have
> a "value control" (currently a label) where is viewed the value data. I
> need
> when a TAB key is pressed the current cell pass to next cell.
>
> My question:
>
> -How I can "focus" morph (the cell) for begin to listen the key presses
> events? that morph is really only a PanelMorph subclass. Really I
> understand
> than need the behavior of list widgets or textboxes for that cell, force
> the
> focus of some way.
>
> Regards and thanks for the answers.
> --
> View this message in context:
> http://n4.nabble.com/Conseils-for-develop-a-grid-tp1299737p1475136.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Force the focus of a panel for start to listen keypress events.

gerard alis
Many many thanks; that has been very useful for me.

Anyway I did decide change the mechanism for load and show data of my grid, on drawing place., and now works much much more fast. Really I have poor knowledge of different posibilities for do one thing, but I´m learning bit a bit.

Now I will use that for my new grid widget.

Regards
12