Silverfrost Forums

Welcome to our forums

Menu in Child window?

19 Apr 2009 12:49 #4428

Is it possible to have menus in a %aw child window residing in a MDI parent frame?

Using the attach window %aw example from the Help files with an additional line for a menu item doesn't work. Anyone any ideas? Thanks.

Best regards

Albert

WINAPP
  INTEGER ctrl,winio@
  EXTERNAL open_func
  CHARACTER*128 fname
  COMMON ctrl
  fname='*.f95'
  i=winio@('%ww[no_border]&')
  i=winio@('%mn[&File[&Open]]&', 'FILE_OPENR[Open]',fname,'+',open_func,'EDIT_FILE',fname)
  i=winio@('%mn[[E&xit]]&','EXIT')
  i=winio@('%pv%fr&',400L,300L)
  i=winio@('%lw',ctrl)
  END
  INTEGER FUNCTION open_func()
  COMMON ctrl
  INTEGER ctrl,winio@
  i=winio@('%pv%aw&',ctrl)
  i=winio@('%mn[Exit]&', 'EXIT')             ! Menu item in child window
  i=winio@('%20.8eb[no_border]','*',0L)
  open_func=1
  END
20 Apr 2009 9:52 #4433

Albert,

I think that the Windows standard is not to have menus in child windows. There is nothing to stop you launching other windows (not child windows) that do have menus.

The norm for child windows is for the menus in the parent window to act on the contents of the child window that has focus. (The same goes for any 'toolbars'). If the child windows have different characteristics (e.g. one is a spreadsheet, another is a graph) then you may need to do some quick work adjusting the grey state of the items in the menus in the parent window, or even altering those menus dynamically (add_menu_item@ and remove_menu_item@ - or enhanced menus).

This strikes me as an application for 'add_focus_monitor@' .

Eddie

20 Apr 2009 10:04 #4434

%mn is not implemented in the mdi child window. In theory it ought to modify the main menu in the frame but this does not happen. The problem is that the child can be maximised and then the child menu would not be visible.

I guess that given time and a lot of effort, ClearWin+ could be improved in this respect but I would suggest using either %pm to get a context menu in the child window or %sm to modify the system menu (hopefully in the child window).

20 Apr 2009 10:36 #4435

Thank you Eddie and Paul.

I didn't realise that it's not standard to have menus in child windows, I'll look into the suggestions you both gave.

I'm rewriting parts of my application which has at the moment an analysis section including graphics region, a spreadsheet section and an animation section on three seperate property sheets. But because I can't work out how to make propertysheets resizable when they include a graphics region, I'm considering using child windows instead of propertysheets for the different sections of the application. Although propertysheets are very appealing and good for the work flow when using the application.

Best regards

Albert

22 Apr 2009 4:02 #4459

Albert,

'Multiple documents' can mean (for example) several documents of the same type (as in Word), or what you are doing, (and what I do) which is to have several windows of different types but all related to the same problem. Can I suggest putting your scalable graphics in the main window, and when the graphics are updated, minimise your other windows using SHOWWINDOW (below)?

     INCLUDE <WINDOWS.INS>
      LOGICAL Q
      Q=SHOWWINDOW (IHWND, SW_MINIMIZE)

(IHWND is the handle to the window you want to minimise)

This works very well for me. If you put this in the callback to the %gr window, then resizing also shuffles the 'data input' window and the 'numerical results' window (as I call them in my program) out of the way (but doesn't close them).

Eddie

23 Apr 2009 7:55 #4461

Eddie,

Thank you for the suggestion, it sounds a very good idea. I'll have a play with that tonight and see if I can get an example working.

Best regards

Albert

Please login to reply.