 |
|
| Computers Forum Index » Computer Languages (Smalltalk) » input field event?... |
|
Page 1 of 1 |
|
| Author |
Message |
| Adam... |
Posted: Sun Nov 01, 2009 6:42 pm |
|
|
|
Guest
|
I am using vw7.6 to build a sentence diagram tool. I am displaying the
file in a text editor widget. I want to capture a mouse click. I want
to be able to, for example, have displayed in the GUI:
the quick brown fox jumped over the lazy dogs.
<click the beginning of the sentence and have the domain insert a
" [ " and redisplay the new string>
[ the quick brown fox jumped over the lazy dogs.
<another click, another update>
[ the quick brown fox ] jumped over the lazy dogs.
I just can't figure out where to capture the #clicked or
#rightClicked, or find any examples. Any help would be appreciated. |
|
|
| Back to top |
|
|
|
| Snorik... |
Posted: Tue Nov 03, 2009 9:26 am |
|
|
|
Guest
|
On 1 Nov., 19:42, Adam <a... at (no spam) crumptons.org> wrote:
Quote: I am using vw7.6 to build a sentence diagram tool. I am displaying the
file in a text editor widget. I want to capture a mouse click. I want
to be able to, for example, have displayed in the GUI:
the quick brown fox jumped over the lazy dogs.
click the beginning of the sentence and have the domain insert a
" [ " and redisplay the new string
[ the quick brown fox jumped over the lazy dogs.
another click, another update
[ the quick brown fox ] jumped over the lazy dogs.
I just can't figure out where to capture the #clicked or
#rightClicked, or find any examples. Any help would be appreciated.
That might be a topic for a Smalltalk daily - how to capture events of
standard widgets and change them accordingly? |
|
|
| Back to top |
|
|
|
| Adam... |
Posted: Fri Nov 06, 2009 5:22 am |
|
|
|
Guest
|
On Nov 3, 3:26 am, Snorik <claus.k... at (no spam) googlemail.com> wrote:
Quote: On 1 Nov., 19:42, Adam <a... at (no spam) crumptons.org> wrote:
I am using vw7.6 to build a sentence diagram tool. I am displaying the
file in a text editor widget. I want to capture a mouse click. I want
to be able to, for example, have displayed in the GUI:
the quick brown fox jumped over the lazy dogs.
click the beginning of the sentence and have the domain insert a
" [ " and redisplay the new string
[ the quick brown fox jumped over the lazy dogs.
another click, another update
[ the quick brown fox ] jumped over the lazy dogs.
I just can't figure out where to capture the #clicked or
#rightClicked, or find any examples. Any help would be appreciated.
That might be a topic for a Smalltalk daily - how to capture events of
standard widgets and change them accordingly?
I finally unraveled part of the mystery. by placing a postBuildWith:
method in my GUI class with the message - self widget: #textEditor
when: #clicked send: #inspect to: self - I can click my widget and in
this case inspect itself. Everything is good, except, now I am not
sure that is what I need to solve my problem.
It is part of the solution. I need to know when the widget is clicked.
But I also need to know where it is clicked. And I actually figured
that out... sort of. I can get the point (x at (no spam) y) where I click, but I
need the point being clicked with reference to the ordered collection
of characters, not the pixels on the screen.
I can see the cursor blinking on the screen and I know it can be moved
by a mouse click in between any two elements in my ordered collection
of characters. What object knows and can be made to tell me everything
about that cursor, like where it is inside my string? If the answer is
Cursor, I am going to need a little more direction.
thanks,
Adam |
|
|
| Back to top |
|
|
|
| Snorik... |
Posted: Fri Nov 06, 2009 9:28 am |
|
|
|
Guest
|
On 6 Nov., 06:22, Adam <a... at (no spam) crumptons.org> wrote:
*snip*
Quote: I can see the cursor blinking on the screen and I know it can be moved
by a mouse click in between any two elements in my ordered collection
of characters. What object knows and can be made to tell me everything
about that cursor, like where it is inside my string? If the answer is
Cursor, I am going to need a little more direction.
I think the Text-Edit knows that, at least it does in VAST, and VS.
There you have a "text selection" which is a point, indicating start
and end of the selection in the collection of characters. |
|
|
| Back to top |
|
|
|
| Snorik... |
Posted: Fri Nov 06, 2009 9:55 am |
|
|
|
Guest
|
On 6 Nov., 10:28, Snorik <claus.k... at (no spam) googlemail.com> wrote:
Quote: On 6 Nov., 06:22, Adam <a... at (no spam) crumptons.org> wrote:
*snip*
I can see the cursor blinking on the screen and I know it can be moved
by a mouse click in between any two elements in my ordered collection
of characters. What object knows and can be made to tell me everything
about that cursor, like where it is inside my string? If the answer is
Cursor, I am going to need a little more direction.
I think the Text-Edit knows that, at least it does in VAST, and VS.
There you have a "text selection" which is a point, indicating start
and end of the selection in the collection of characters.
Sorry, that came out wrong, you have a text selection, which is the
result of some EntryField user.dll call.
If you have highlighted text, then x is the starting point and y is
the end point.
If the cursor is only there and you do not have highlighted text, then
x is one number larger than y, y indicating the cursor position.
Example, "|" being the cursor.
example| -> highlighted -> 0 at (no spam) 7
example| -> not highlighted -> 8 at (no spam) 7 |
|
|
| Back to top |
|
|
|
| dlaughlin... |
Posted: Fri Nov 06, 2009 8:17 pm |
|
|
|
Guest
|
On Nov 6, 12:22 am, Adam <a... at (no spam) crumptons.org> wrote:
Quote: On Nov 3, 3:26 am, Snorik <claus.k... at (no spam) googlemail.com> wrote:
On 1 Nov., 19:42, Adam <a... at (no spam) crumptons.org> wrote:
I am using vw7.6 to build a sentence diagram tool. I am displaying the
file in a text editor widget. I want to capture a mouse click. I want
to be able to, for example, have displayed in the GUI:
the quick brown fox jumped over the lazy dogs.
click the beginning of the sentence and have the domain insert a
" [ " and redisplay the new string
[ the quick brown fox jumped over the lazy dogs.
another click, another update
[ the quick brown fox ] jumped over the lazy dogs.
I just can't figure out where to capture the #clicked or
#rightClicked, or find any examples. Any help would be appreciated.
That might be a topic for a Smalltalk daily - how to capture events of
standard widgets and change them accordingly?
I finally unraveled part of the mystery. by placing a postBuildWith:
method in my GUI class with the message - self widget: #textEditor
when: #clicked send: #inspect to: self - I can click my widget and in
this case inspect itself. Everything is good, except, now I am not
sure that is what I need to solve my problem.
It is part of the solution. I need to know when the widget is clicked.
But I also need to know where it is clicked. And I actually figured
that out... sort of. I can get the point (x at (no spam) y) where I click, but I
need the point being clicked with reference to the ordered collection
of characters, not the pixels on the screen.
I can see the cursor blinking on the screen and I know it can be moved
by a mouse click in between any two elements in my ordered collection
of characters. What object knows and can be made to tell me everything
about that cursor, like where it is inside my string? If the answer is
Cursor, I am going to need a little more direction.
thanks,
Adam
There should be a #yellowButtonPressedEvent: method in
TextEditorController. Right clicks on this Controller will pass
through here. You could then use ParagraphEditor's (superclass of
TextEditorController) #appendToSelection: to add your '['. Although
#appendToSelection: has the ominous comment "Append aString to the end
of the current selection point. It is assumed the string was entered
through typing." You might want to make a subclass of
TextEditorController to do this too. |
|
|
| Back to top |
|
|
|
|
|
All times are GMT
The time now is Thu Dec 10, 2009 2:13 pm
|
|