Activating a Dolphin To Go Application

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

Activating a Dolphin To Go Application

Jerome Chan
How do I bring a To Go application to the front? I'm writing a simple
hotkey based application and would like the hotkey to bring a
particular window to the front for the user to interact with. I've
already figured out how to register the hot key and how to trap it but
now I can't activate the window with beActive or setFocus. Any clues?


Reply | Threaded
Open this post in threaded view
|

Re: Activating a Dolphin To Go Application

Mark Wilden
"Jerome Chan" <[hidden email]> wrote in message
news:[hidden email]...

> How do I bring a To Go application to the front?

Someone here may have a suggestion, but this is really a Windows problem
rather than a Smalltalk or Dolphin problem. Basically, Windows makes it hard
(impossible?) to programmatically bring a window "to the front." The best
you can do is to flash the taskbar icon. This is so bad programs can't pop
up in front of you while you're working (very annoying).

It's been some time since I looked into this last, but again, it would be
best to ask on a Windows-oriented group, I think.


Reply | Threaded
Open this post in threaded view
|

Re: Activating a Dolphin To Go Application

Louis Sumberg-2
In reply to this post by Jerome Chan
Jerome,

> How do I bring a To Go application to the front?

Looking at category 'operations' in View, I see #beForeground, #beTopMost,
and #zOrderTop.  I'd think one of these should do the job.  I know I've used
the following in at least of my apps:

    self view beTopMost beNotTopMost

-- Louis


Reply | Threaded
Open this post in threaded view
|

Re: Activating a Dolphin To Go Application

Chris Uppal-3
In reply to this post by Jerome Chan
Jerome Chan wrote:

> How do I bring a To Go application to the front? I'm writing a simple
> hotkey based application and would like the hotkey to bring a
> particular window to the front for the user to interact with. I've
> already figured out how to register the hot key and how to trap it but
> now I can't activate the window with beActive or setFocus. Any clues?

I'm not quite sure what you are doing, so this may not help at all.

You can try:

    aShell view beForeground.

which seems to work for me.  But then:

    aShell view beActive.

also works for me, so I don't know what I'm doing different.

The difference between #beForeground and #beActive appears to be subtle, and
the MSDN documentation is as confusing (or confused) as ever.  However, my best
guess is that SetActiveWindow() is intended for switching between the windows
of an application that the user is already interacting with (has focus, etc),
whereas SetForegroundWindow() is for use in a wider context (and which
therefore implements the behaviour that Mark Wilden described).

BTW (for Louis), #beTopMost is for setting the "always on top" property.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Activating a Dolphin To Go Application

Jerome Chan
In reply to this post by Louis Sumberg-2
"Louis Sumberg" <[hidden email]> wrote in message news:<c4qk3o$2lg7pl$[hidden email]>...

> Jerome,
>
> > How do I bring a To Go application to the front?
>
> Looking at category 'operations' in View, I see #beForeground, #beTopMost,
> and #zOrderTop.  I'd think one of these should do the job.  I know I've used
> the following in at least of my apps:
>
>     self view beTopMost beNotTopMost
>
> -- Louis

Thanks. It works when you do perform the operations in the following order:

        self view beTopMost.
        self view beNotTopMost.
        self view beForeground.
        self view beActive.
        self view setFocus


Reply | Threaded
Open this post in threaded view
|

Re: Activating a Dolphin To Go Application

Uladzimir Liashkevich
Jerome Chan wrote:

> "Louis Sumberg" <[hidden email]> wrote in message news:<c4qk3o$2lg7pl$[hidden email]>...
>
>>Jerome,
>>
>>
>>>How do I bring a To Go application to the front?
>>
>>Looking at category 'operations' in View, I see #beForeground, #beTopMost,
>>and #zOrderTop.  I'd think one of these should do the job.  I know I've used
>>the following in at least of my apps:
>>
>>    self view beTopMost beNotTopMost
>>
>>-- Louis
>
>
> Thanks. It works when you do perform the operations in the following order:
>
> self view beTopMost.
> self view beNotTopMost.
> self view beForeground.
> self view beActive.
> self view setFocus

I think it doesn't work in all cases. Try to make keyboard input during
application activation, you'll see what I mean...

Basically you need to perform the following sequence to accomplish the goal:

* retrieve foreground window - GetForegroundWindow
* retrieve its thread id - GetWindowThreadProcessId
* attach input to thread if it is not current thread - AttachThreadInput
* bring window to top - SetForegroundWindow + BringWindowToTop
* detach input from thread if needed
* restore window if it is minimized

I hope this helps.

--

Uladzimir.