Joseph,
> I just bought Dolphin Smalltalk XP Pro 5.1 and I am writing my first
> application.
> It's a small program to log values to a text file.
> I have a NumberPresenter and a PushButton.
> When the user clicks on the button, the value is logged and I want to select
> automaticaly the content of the NumberPresenter so that he can enter
> immediately the next value.
> How can I do that ?
> I tried the method setfocus in my presenter but it doesn't select the
> content.
Setting the focus is a good start. You can try this in a workspace:
| aView |
aView := ( NumberPresenter showOn:3 ) view.
[ aView selectAll; setFocus ] postToInputQueue.
In your case, you would simply send #view to your number presenter, and
then (if is indeed a TextEdit, which seems likely), send #selectAll, and
#setFocus. #postToInputQueue is probably necessary in my example, you
might be able to get away without it, though it is probably a good idea
unless is causes you some other kind of trouble.
Note that Windows will probably not display the selection unless the
view has the input focus. I also once spent a fair amount of time
debugging an unfortunate color scheme selection, so be sure not to fall
for that one (background and selected color being the same).
One place where #postToInputQueue can be problematic is with presenters
that you plan to drive from unit tests.
As a general browsing tip, it often helps to use the ViewComposer to
look inside the structure of the presenter that is mystifying you. From
there, you can browse the class of the element(s) you want to change,
and scrounge around for methods.
Have a good one,
Bill
--
Wilhelm K. Schwab, Ph.D.
[hidden email]