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 

Output to main window with a frame and child window

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



Joined: 31 Dec 2008
Posts: 6

PostPosted: Tue Jan 13, 2009 2:05 am    Post subject: Output to main window with a frame and child window Reply with quote

I want the user to toggle between a main window and a dialog box created as a child window. A snippet of my code ...

PROGRAM main
include windows.ins
common ctrl
integer main,ctrl

x = clearwin_info@('system_height')
y = clearwin_info@('system_depth')

main = winio@('%ca[Main Window]%sz&',x,y)
main = winio@('%bg[black]&')
main = winio@('%wp[ID_LOGO]&')
main = winio@('%ws','My Name and Info')
main = winio@('%fr&',x,y)
main = winio@('%lw',ctrl)
END

SUBROUTINE input
include windows.ins
common ctrl
integer child,ctrl

child = winio@('%aw',ctrl)
.
.
.
END

I want to add a background image and some output to the main window. And, I want the child window to be able to move about in the main window while the background is still visible. However, the main window is hidden by the frame holding the child window. I tried writing to the frame instead, but it doesn't work. Also, I'm going to clear the main window for drawing once another program executes. How do I have a background with text displayed in the main window and still have the child move only within the main window?
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Sun Jan 18, 2009 1:09 pm    Post subject: Reply with quote

I was rather disappointed to see no-one had replied to this thread, as I have always been a bit nervous of MDI applications, frames and child windows, and I was looking out to see an expert reply to you!

I took your code and turned it into something that actually works (you took out so much to make it maneageable that it wouldn't run):

Code:
      options (intl)
      winapp

      PROGRAM Parent
      include <windows.ins>
      common ctrl
      integer main, ctrl, x, y
      external INPUT

      Y = GetSystemMetrics(SM_CYSCREEN)
      X = GetSystemMetrics(SM_CXSCREEN)

      main = winio@('%ca[Main Window]&')
C      main = winio@('%sz&',8*x/10,8*y/10)
      main = winio@('%bg[white]&')
C      main = winio@('%ws','My Name and Info')
      main = winio@('%mn[Child]&', INPUT)
      main = winio@('%fr&',6*x/10,6*y/10)
      main = winio@('%wp[A1]&')
      main = winio@('%lw',ctrl)
      END

      Integer function input()
      include <windows.ins>
      common ctrl
      integer child,ctrl

      child = winio@('%aw&',ctrl)
      child = winio@('%cn%6bt[Quit]')

      input = 1
      END


(You'll also see from this that I operate in "fortran 77" mode!) I created an icon A1 to do the wallpaper. Yes, the wallpaper doesn't show in the area of the frame, only whatever has been specified as the background colour. I thought that was a pity, as the wallpaper seems to me more natural in an MDI frame than anywhere else.

You can generate several child windows with the single menu - I was too idle to give them separate controls.

You can push one of the child windows left, right and down quite a long way relative to the frame - but not up, because you have to grab the caption bar of the frame, and that limits how far up it can be pushed. I checked with the CWPLUS.ENH file (which sometimes has snippets of info that aren't in FTN95.CHM), and this is intended behaviour - there are even suggestions as to how you exploit it.

Since a child window with no caption bar can't be moved, one could, of course, create a child window with %ww[no_caption,maximise] AND its own %wp, which fills the frame. This might need some extra effort if the frame has a %pv, and is therefore resizable.

It strikes me that toolbars could be created as no_caption child windows and that it would be very easy to have them snap to the top or left of the frame with an appropriate button. However, floating toolbars are a rather more complex proposition (I'm guessing here).

Regards

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