mIRC Home    About    Download    Register    News    Help

Print Thread
#167835 31/12/06 01:28 PM
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
//window -a @test | echo -a STATE $window(@test).state ACTIVE $active
Why does it output 'STATE normal ACTIVE @test' instead of 'STATE active ACTIVE @test'?

Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
From the helpfile:
Quote:

$window(N/@name)
Returns properties for a window.

...

state returns minimized/maximized/hidden/normal


Active isn't in there. $active tells you if the window is active; is that not enough? wink


Sais
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
No, it's not enough, though, not for this reason. While trying things out, I was wrongly assuming it had an .active property.

I'm trying to make a dialog to navigate to certain, in the dialog listboxes listed, windows, some desktop, some not, depending upon configuration.
When I click (in a dialog list) for example on the name of a channel window, it should toggle between active and hidden.

Code:
alias togglewin { if ($istok(minimized hidden,$window($1-).state,32)) { window -a $+(",$1-,") } | else { window -h $+(",$1-,") } }

With above code, when the selected window is graphically present (doesnt matter fully visible, partly or completely covered by other window(s)), to make it active, it needs two clicks instead of one.
The practical situation is then that I can toggle with one click one window, but if I select another window, and select then that first one back, I have to click twice.
Result is that one time, I have to click once to make a window active, and the other time, I have to click twice, which is annoying and confusing, especially if the script lags abit due to other tasks.

Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Does this help?

Code:
alias togglewin { if ($istok(minimized hidden,$window($1-).state,32) || (!$window($1).mdi && ($active != $1))) { window -a $qt($1-) } | else { window -h $qt($1-) } }


[edit]
or indeed:
Code:
alias togglewin { if ($active != $1) { window -a $qt($1-) } | else { window -h $qt($1-) } } 


(or am I missing something in what you are trying to achieve?)

Last edited by Sais; 02/01/07 10:22 AM.

Sais
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
Well that gives again the same annoyant trouble.

When I do /test, it creates the 3 desktop windows, I click on the dialog toggle1 button, @test1 becomes active, I click another time on toggle1, and it just flickers once and is still active. When I click repeatedly, sometimes with 5sec between, sometimes with 1 sec, the window hides *sometimes*, it mostly stays active.

When I remove the -d switches from the /window creation commands,
and click on for ex toggle1, @test1 becomes active, another click hides it, and then I can't make it active again. But, if I now click on ex toggle2, then @test2 becomes active, and then I can activate @test1 again.

Btw, I fixed the first $1 check for $1-, for whatever it matters regarding this issue, though.

Last edited by RRX; 02/01/07 07:19 PM.
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
OK, looks like you need three conditions:
Code:
alias togglewin { 
  if ($active == $1-) { 
    ;; It's active. Hide it.
    window -h $qt($1-) 
  } 
  elseif (!$istok(minimized hidden,$window($1-).state,32)) {
    ;; It's not active, but it is visible. Hide it.
    window -h $qt($1-) 
  }
  else {
    ;; It's not visible, activate it.
    window -a $qt($1-) 
  } 
} 


Now the problem is that if your three windows overlap such that you cannot see all of one of them it will take two clicks to activate it since the code believes that it is, in fact, visible.

Part of the problem is that when you are using a dialog, the active window is that from which the dialog was launched, not the most recently active window. I can't think of a way to get around that at the moment.


Sais

Link Copied to Clipboard