Subject: FVWM: fvwm toggle button

From: [email-masked] (Jodok Ole Müllers)
Date: Fri, 10 May 2002 23:56:31 +0200

Hi,

Has anybody an idea how to ceate a "toggle" button.
I want to press it and if the winlist is off it will turn it on
and if it is on it will turn it of.

Pseuydocode:

...
*FvwmButtons(Title "Toggle Winlist",ActionToggleFvwmWinlist )
....

AddToFunc ToggleFvwmWinlist
+ Module FvwmWinList if WinListIsOff
+ KillModule FvwmWinList if WinListIsOn

-- 
aim: jomprivate
icq: 8865443
msn: kaputtnik51
pgp: lynx --dump http://www.muenster.de/~muellers/pgp.asc | gpg --import

/"\
\ / ASCII ribbon campaign
  X  against HTML mail
/ \ and postings - est. June 1998

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 10 May 2002 22:17:38 +0000

> + KillModule FvwmWinList if WinListIsOn

Even if it looks like a classic if-else problem that is only easily
solvable in 2.5.x versions, it may be easily done in 2.4.x+ too due to
the way Module and functions in FVWM work:

  AddToFunc ToggleFvwmWinList
  + I None (FvwmWinList, CirculateHit) Module FvwmWinList
  + I Next (FvwmWinList, CirculateHit) Close

"Module FvwmWinList" is guaranteed to create a new window only after a
function is finished and "Next Close" is failed.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 13 May 2002 12:09:34 +0200

> + KillModule FvwmWinList if WinListIsOn

This is what our FAQ says (example from my config file):

7.12  Toggling windows on and off.                                              
                                                                                
   It is often desirable to have a menu item of perhaps a button in             
   FvwmButtons or FvwmWharf that launches an application when used              
   the first time and closes it if used a second time.  Although it             
   is not obvious how to do this, it is possible.  Let's assume you             
   need a menu item that toggles an FvwmConsole window on and off.              
   Then put the following lines in your .fvwm2rc:                               
                                                                                
     AddToFunc ToggleFvwmConsole                                                
     + I None (FvwmConsole) Module FvwmConsole                                  
     + I Next (CurrentPage Visible FvwmConsole) Close                           
     + I Next (FvwmConsole) MoveToDesk                                          
     + I Next (FvwmConsole) MoveToPage                                          
     + I Next (FvwmConsole) Raise                                               
                                                                                
     AddToMenu <some menu>                                                      
     + "toggle FvwmConsole" Function ToggleFvwmConsole                          
                                                                                
   Or if you prefer a button in the button bar:                                 
                                                                                
     *FvwmButtons(Action ToggleFvwmConsole)                                     
                                                                                
   The lines with MoveToDesk, MoveToPage and Raise will bring the               
   window to the top of the current page if it is not visible                   
   instead of closing it.                                                       
                                                                                
   If you want to toggle one specific window, e.g. an xterm, but                
   still want to have other xterms that are not toggled, you must               
   give the window an unique name:                                              
                                                                                
     AddToFunc ToggleXMessages                                                  
     + I None (XMessages) Exec ( TERM -T XMessages -n XMessages \               
         -e exec tail -f /var/adm/?* ~/.X.err )                                 
     + I Next (XMessages) Close                                                 
                                                                                
   Or for a toggling Netscape button:                                           
                                                                                
     AddToFunc ToggleNetscape                                                   
     + I None (Navigator) Exec exec netscape                                    
     + I All (Navigator) Close                                                  
                                                                                
   Keep in mind that these functions simply check if a window with              
   the specified name exists.  They will happily close manually                 
   opened windows or launch an application multiple times if the                
   application is slow to start (e.g. like netscape).                           
                                                                                
Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].