|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Sat Jun 21, 2008 3:38 pm Post subject: Any way to make a window minimize or restore itself? |
|
|
I wonder if there is any way to make a format window minimise or restore itself under program control? Obviously, one can close a window and re-open it - this might be the best method anyway, and if I can't find an answer, that is what I will do.
However, what I was looking for was a routine that made (say) the current window, or window with handle IW, shrink down to either the taskbar on the desktop or to simply its own caption bar.
Shrinking a format window to the desktop taskbar is easy for the user to do, and the same goes for restoring it.
Shrinking a format window manually to its own caption bar only seems possible for a window that contains only a control that takes a pivot, and if that is a graphics area, then the callback must have a procedure in place for redrawing (i.e. NOT redrawing!) when the window size is (0,0) or 0 in one direction.
I have found CALL SET_CONTROL_VISIBILITY@ which can make the whole window disappear or reappear under program control, but in the context I am looking at, that is no improvement on closing and reopening.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Sat Jun 21, 2008 7:45 pm Post subject: |
|
|
You can use the Windows API function ShowWindow.
You can find details on the Microsoft MSDN website. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Sat Jun 21, 2008 8:28 pm Post subject: |
|
|
Hi Paul,
I didn't even look at ShowWindow, because the FTN95.CHM says don't use it!
I think that I can get the functionality with a combination of %ww[minimize] and ShowWindow. Thanks for the tip.
Anyone know how to minimise a window down to its title bar? (%ww[minimise] does it). There's obviously a bit of exploring to do ...
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Sun Jun 22, 2008 7:40 am Post subject: |
|
|
I guess that you are advised not to use ShowWindow with SW_SHOW and SW_HIDE because there are ClearWin+ ways to do this. But other SW_ parameters may be useful.
If "minimising down to the title bar" means what I think it means then you may have to experiment and adjust the size of the window programmatically. There will be a ClearWin+ routine to do this. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Sun Jun 22, 2008 10:40 pm Post subject: |
|
|
Hi Paul,
Perhaps if I explain what I was thinking of doing, you will understand my badly phrased question better.
In the background, there is a main window with a graphics area. Selecting one of several menu options brings up a data input "form" (window). On that window, there is "calculate" button. When that is pressed, the call back routine does the calculations and draws the resulting objects on the graphics area in the main window.
However, as the main window is resizable, it could be entirely behind the data input form, and then it looks as though nothing has happened but a brief flash.
Hence, although I wanted the form to stay displayed, I want the underlying master window to be most obvious. I have had various experiments, and decided that the best thing to do was to reduce the data input form window in size, but to park it somewhere where it can be seen. Eventually, I decided that %ww[minimise] combined with a move_window@ did what I wanted - which is to park the data entry form in an appropriate place on the graphics area where it can be seen, but doesn't cover anything much.
ShowWindow with SW_SHOW and SW_HIDE are indeed useful, and I guess that the advice on not using Show Window isn't against this usage, but against creating and destroying the window with the API function, as it could leave some Clearwin+ routines "dangling". However, you can't use ShowWindow (with SW_HIDE) while you are building a Clearwin window, as it doesn't work until the window is displayed - maybe it would work in a %sc callback, although I didn't try that - and after the window ws displayed, you lose immediate programming control if the window is "modal".
In looking up ShowWindow in the include files, I saw that it was a Boolean function, which is of course a logical (no pun intended!) translation of what is in the MSDN help info. This does mean that in the invocation:
IW = ShowWindow ( SW_HIDE, IHANDLE)
... IW has to be Logical as there is no logical to integer type coercion, even though FTN95 treats .true. and .false. as 0 and 1 (I forget which way round).
Anyway, I learnt a lot in my excursion into the API, so thanks.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Mon Jun 23, 2008 8:00 am Post subject: |
|
|
I was thinking that you would try using SW_MINIMIZE or perhaps SW_SHOWMINIMIZED. Note that IHANDLE is the first argument. |
|
Back to top |
|
|
|
|
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
|