forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Closing main window and reopen program, checkboxes

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Felin



Joined: 29 Jul 2009
Posts: 7
Location: Erlangen, Germany

PostPosted: Wed Jul 29, 2009 1:30 pm    Post subject: Closing main window and reopen program, checkboxes Reply with quote

I've got some problems in an existing program which I should change. It's quite a big program and it's not possible for me to understand everything behind it, especially as I'm not very experienced in programming. The main output is a graphic.

The whole graphic (which changes while the program is running) is produced in a subroutine which is called by another subroutine named LEMUE. LEMUE is called by the main program.
My "Reset"-function should theoretically set all variables back to the initial state and then calls again LEMUE which calls the graphic-subroutine again. Pressing the reset button, the original graphic stops and another graphic is opened in a completely new window, also as a new element at the taskbar and so on. But I only want one of those windows to be open at the same time. So, how can I let the program close the first window automatically if the reset button is pressed?
Or is it maybe possible to use a System-call and close the program completely and reopen it again automatically?
If I use taskkill in a batch-file (not very elegant, I know) to stop the program and then call LEMUE, there will be only one window open, but the graphics created by WINIO flicker constantly (but not the graphics which are produced inside the area created with "%gr").

At the moment the checkboxes which are tagged before pressing the reset button, stay checked when the reset button is pressed, also in the new window, but the associated function is not called. I would prefer them not being checked at all. How to do this?
Is it also possible to keep a checkbox checked even if the user clicks on it once to tag it and after this clicks on it again?

Here how the window and checkboxes are created:

Code:
 
      HND1=1   
      WIN=WINIO@('%CA[NLOOP GRAFIK AREA (1024X768)]&')
      WIN=WINIO@('%MN[&FILE[E&XIT]]&',ENDE)
      WIN=WINIO@('%MN[&HELP[&ABOUT GRAPH2]]&',ABOUTF)
      WIN=WINIO@('%^BT[E&XIT]%TA&',ENDE)
      WIN=WINIO@('%TA%^BT[&PAUSE]&',WAIT)
      WIN=WINIO@('%TA%^BT[&RESET]&',RESET)     
      WIN=WINIO@('%TA%^BT[&SIGNALS]&',SIGNALE)
      WIN=WINIO@('%TA%^BT[P&LOTS]&',PLOTUWE)
      WIN=WINIO@('%3ga&',SLOW,MEDIUM,FAST)
      WIN=WINIO@('%2NL%2TA%^RB[SLOW  ]&',SLOW,SLOW1)
      WIN=WINIO@('%TA%`^RB[RERUN ]&',RERUN,RERUN1)
      WIN=WINIO@('%NL%2TA%^RB[MEDIUM]&',MEDIUM,MEDIUM1)
      WIN=WINIO@('%NL%2TA%^RB[FAST  ]&',FAST,FAST1)
      WIN=WINIO@('%NL%`^RB[BUTTONA]&',BUTTONA,BUTTONA1)
      win=winio@('%2TA%`^RB[BUTTONB]&',BUTTONB,BUTTONB1)           
      ...
      WIN=WINIO@('%2NL%`BG&',RGB@(130,130,130))
      WIN=WINIO@('%`GR&',1200L,780L,HND1)
      WIN=WINIO@('%WW[MAXIMIZE]%LW',CNTRL)



It would be great if somebody could help me with some of those problems. Smile

Thank you very much, already now.
[/code]
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sun Aug 02, 2009 12:05 am    Post subject: Reply with quote

If you want a checkbox to stay ticked, then use a grey code to grey it out immediately after you set it. The special code is the tilde (~) - see %rb in the alphabetical list of format codes in FTN95.CHM

If one of the callbacks to a button press is to close the main window, and re-open it with everything re-initialised, then you can do it with a GOTO

Code:
   10   CONTINUE
C ... all the WINIO@ window stuff, starting with %ca and ending with no &
         GO TO 10


The return code from the RESET button must be 0 to cause the parent window to close, but before you do that, reset all the grey codes and radio button variables to your defaults. When the main window closes, the GOTO sends you to the top of the list of WINIO@s to redraw a new main window.

As I have explained it here, you can't actually quit! Your ENDE function needs to set some variable that you test before doing the GOTO, for example

Code:
        IF (.NOT. RESTART) GO TO 10


(RESTART is a LOGICAL that is .FALSE. initially, and is set to .TRUE. in the callback ENDE). You can arrange for LEMUE to be called in the body of the WINIO@ calls, or better still, put it in the callback to a %sc startup control.

From experience, a main window can be closed and re-opened very quickly on a modern PC, unless it uses %ib buttons - when it is very slow. Toolbars drawn with %tb redraw much faster. Hence there isn't much point in using fakery such as freezing the window contents.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group