Need ideas on trapping the TAB key

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

Need ideas on trapping the TAB key

Costas
I would like to use the TAB key to indent multiple lines in a
workspace.

I trap the TAB key at
 ShellView>>preTranslateKeyboardInput: aMSG

I need to process the Tab key but only if  pressed while in the CHB
workspace.  I have tried testing as follows:

Ideally I want to do this

ShellView>>preTranslateKeyboardInput: aMSG

"My code added after vKey is obtained"
vKey == VK_TAB ifTrue: [
        (self presenter isMemberOf: SmalltalkWorkspace)  ifTrue: [
                self presenter indent.  "Call indent method"
                                     ^0
         ].
].

However the presenter is ClassBrowserShell and not SmalltalWorkspace.
Is there anyway I can tell which of the subviews of CHB had focus when
the Tab key was pressed at this point?

I tried to  trap the key in the RichEdit View but by then the line and
the tab key have been processed.

Regards,

Costas


Reply | Threaded
Open this post in threaded view
|

Re: Need ideas on trapping the TAB key

Stefan Schmiedl
Warning: Non-solution ahead!


On Wed, 12 Jun 2002 20:22:16 GMT,
Costas <[hidden email]> wrote:
> I would like to use the TAB key to indent multiple lines in a
> workspace.

If you're using D5, I'd go for the simple solution
and let the system reformat your code upon accepting.
Then get used to Ctrl-s instead of Tab.

s.


Reply | Threaded
Open this post in threaded view
|

Re: Need ideas on trapping the TAB key

Costas
On 12 Jun 2002 20:37:50 GMT, Stefan Schmiedl <[hidden email]> wrote:

>Warning: Non-solution ahead!
>
>
>On Wed, 12 Jun 2002 20:22:16 GMT,
>Costas <[hidden email]> wrote:
>> I would like to use the TAB key to indent multiple lines in a
>> workspace.
>
>If you're using D5, I'd go for the simple solution
>and let the system reformat your code upon accepting.
>Then get used to Ctrl-s instead of Tab.

I prefer my own style of formatting. I like to make it more structured
looking especially when it comes to the brackets. For example I find
this easier to read than the one below.

test
        a = b ifTrue: [
                b > 1 ifFalse: [
                        b:=0.
                ] ifTrue: [
                        b:=1.
                        self at: 1 put:: a.
                ].
        ].



test
        a = b
                ifTrue:
                        [b > 1
                                ifFalse: [b := 0]
                                ifTrue:
                                        [b := 1.
                                        self at: 1 put: a]]].

Regards,

Cosats