Aleniko


Hi all;

I'm trying to add the functionality of the 'window' menu bar into my own menu. I need to let users switch between windows open. I've tried adding pad name "_msm_windo" to my menu using foxpro's menu generator.

I've also tried sys(1500,"_msm_menu","_sysmenu")

Both didn't work.

I've used menu pads under Foxpro2.6 with no problems but this is the first time I'm trying to use an entire menu (ie: Window)

Help!




Re: Adding the _msm_windo to my menu.

Naomi Nosonovsky


Hi Alen,

Here is a recent solution by Borislav Borissov:

Code Snippet

CreateMenu()
oForm = CREATEOBJECT([Form1])
oForm.Show(1)
READ EVENTS
SET SYSMENU TO DEFAULT


FUNCTION CreateMenu()
* *********************************************************
* *
* * 29.06.2007 a. MENU1.MPR 19:19:07
* *
* *********************************************************
* *
* * Author's Name
* *
* * Copyright (C) 2007 Company Name
* * Address
* * City, Zip
* *
* * Description:
* * This PROGRAM was automatically generated BY GENMENU.
* *
* *********************************************************


* *********************************************************
* *
* * Menu Definition
* *
* *********************************************************
*

SET SYSMENU TO
SET SYSMENU AUTOMATIC


DEFINE PAD _msm_windo OF _MSYSMENU PROMPT "\<Window" COLOR SCHEME 3 ;
NEGOTIATE RIGHT, LEFT ;
KEY ALT+W, "" ;
MESSAGE "Manipulates windows, displays Command and Data Session windows"
ON PAD _msm_windo OF _MSYSMENU ACTIVATE POPUP _mwindow

**************************
***** THIS *****
**************************
DEFINE POPUP _mwindow MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR _mwi_cascade OF _mwindow PROMPT "Ca\<scade" ;
PICTRES _mwi_cascade ;
MESSAGE "Arranges windows as cascading tiles"
DEFINE BAR _mwi_arran OF _mwindow PROMPT "\<Arrange All" ;
PICTRES _mwi_arran ;
MESSAGE "Arranges windows as non-overlapping tiles"
DEFINE BAR _mwi_sp100 OF _mwindow PROMPT "\-" ;
PICTRES _mwi_sp100
DEFINE BAR _mwi_dockable OF _mwindow PROMPT "Doc\<kable" ;
PICTRES _mwi_dockable ;
MESSAGE "Enable docking of this window"
DEFINE BAR _mwi_hide OF _mwindow PROMPT "\<Hide" ;
PICTRES _mwi_hide ;
MESSAGE "Hides the active window"
DEFINE BAR _mwi_hidea OF _mwindow PROMPT "Hide All" ;
PICTRES _mwi_hidea ;
MESSAGE "Hides all windows"
DEFINE BAR _mwi_showa OF _mwindow PROMPT "Sh\<ow All" ;
PICTRES _mwi_showa ;
MESSAGE "Shows all hidden windows"
DEFINE BAR _mwi_sp200 OF _mwindow PROMPT "\-" ;
PICTRES _mwi_sp200
DEFINE BAR _mwi_clear OF _mwindow PROMPT "Clea\<r" ;
PICTRES _mwi_clear ;
MESSAGE "Clears text from the application workspace or the current output window"
DEFINE BAR _mwi_rotat OF _mwindow PROMPT "C\<ycle" ;
KEY CTRL+F1, "Ctrl+F1" ;
PICTRES _mwi_rotat ;
MESSAGE "Cycles through all open windows"
DEFINE BAR _mwi_sp200 OF _mwindow PROMPT "\-" ;
PICTRES _mwi_sp200
DEFINE BAR _mwi_cmd OF _mwindow PROMPT "\<Command Window" ;
KEY CTRL+F2, "Ctrl+F2" ;
PICTRES _mwi_cmd ;
MESSAGE "Displays the Command window"
DEFINE BAR _mwi_view OF _mwindow PROMPT "\<Data Session" ;
PICTRES _mwi_view ;
MESSAGE "Displays the Data Session window"
DEFINE BAR _mwi_properties OF _mwindow PROMPT "\<Properties Window" ;
PICTRES _mwi_properties ;
MESSAGE "Display the Properties window"
RETURN



**************************************************
*-- Form: form1 (d:\works\form1.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 06/29/07 07:19:07 PM
*
DEFINE CLASS form1 AS form


DoCreate = .T.
Caption = "Form1"
Name = "Form1"


PROCEDURE Destroy
CLEAR EVENTS
ENDPROC


ENDDEFINE
*
*-- EndDefine: form1






Re: Adding the _msm_windo to my menu.

Aleniko

Naomi;

I don't think this is a solution. I want the functionality of _MSM_WINDO which shows any open windows and allows the user to select one. I think here the solution is using CTRL-F1 (Amond other option).

Also, Isn't there a simpler solution I can incorporate into my MNX

Thanks.





Re: Adding the _msm_windo to my menu.

Naomi Nosonovsky

Alen,

It is the solution. You don't need to do it programmatically as shown here, of course. You just need to add pad and popup properly named _mwindow (for the popup) and it will do the job.

In my applications I have sligthly different functionality coded by my late colleague. We have window pad menu and in the form's manager class we add open forms to it by re-defining the menu. If you want this idea, I'll have to check it tomorrow from work.





Re: Adding the _msm_windo to my menu.

MarciaAkins

Aleniko wrote:

I'm trying to add the functionality of the 'window' menu bar into my own menu. I need to let users switch between windows open. I've tried adding pad name "_msm_windo" to my menu using foxpro's menu generator.

You were on the right track.

Code Snippet
DEFINE PAD _msm_windo OF _MSYSMENU PROMPT "\<Window" COLOR SCHEME 3
ON PAD _msm_windo OF _MSYSMENU ACTIVATE POPUP _mwindow
DEFINE POPUP _mwindow MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF _mwindow PROMPT "Active Windows"

The menu needs at least 1 bar to work.






Re: Adding the _msm_windo to my menu.

Aleniko

I thank you all for your help on the coding side... But:

Have anyone here actually tried to add this functionality into the MNX file I understand I can code this. I also understand I can do a quick menu and cut-paste parts into my mpr. But anything I tried to do in order to use vfp's menu generator - failed.
I tried to copy exactly what I find in a quick-menu into my own menu.
The problem is that when I create a submenu, the submenu name is not _mwindow but rather "newitem". All pads created under "Newitem" work perfectly but the open windows don't display.
I've ended up USEing the MNX file and simply renaming "Newitem" to _mwindow. That solved the problem.

So, again, I hope I'm missing something big time here because otherwise the only way to add this functionality in the MNX file is to USE it and edit the entries.

Thanks.




Re: Adding the _msm_windo to my menu.

Naomi Nosonovsky

That's actually a very good question. Yesterday at night I quickly tried to create this myself and somehow it was not easy and Generate never become enabled for some unknown reason.

I'm going to ask Borislav how exactly did he do this.

Also I think that Menu designer is now one of the lamest designers. Not sure if there is any improvement in Sedna. I've seen alternative Menu Designer by Greg Green in UT Downloads and tried it once. It was a very good replacement (in a treeview mode), but I got few minor problems and never re-checked this file again.





Re: Adding the _msm_windo to my menu.

Naomi Nosonovsky

Actually, I've just tried again and since here Generate works fine, I found the simple steps:

1. Create a Pad, name it \ < Window (no space after < ) and add using Options dialog (Pad Name) _msm_windo

2. Use Insert Bar option and pick any of the options, say, Show All.

Here is what I got after I did this:

Code Snippet

DEFINE PAD _msm_windo OF _MSYSMENU PROMPT "Window" COLOR SCHEME 3 ;
KEY ALT+W, ""
ON PAD _msm_windo OF _MSYSMENU ACTIVATE POPUP window

DEFINE POPUP window MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR _mwi_showa OF window PROMPT "Sh\<ow All" ;
MESSAGE "Shows all hidden windows"





Re: Adding the _msm_windo to my menu.

Aleniko

OK...
Thanks to Naomi, I got forwarded to a thread on UT which had no answer. THEN, there was a link from UT to some other place.
Here is the answer (Credit and partial credits given to Naomi, Richard Hendricks and 25 or so other people...):

Its important to name your main menu item _MWINDOW otherwise this will not work. My way was to hack the menu file... Fortunately, if you click the VIEW/Menu options on the FoxPro System Menu, you'll find an easier way to do so. DUH.

Thank you all and I hope you enjoyed the thread :-)





Re: Adding the _msm_windo to my menu.

Naomi Nosonovsky

We sure had some fun Smile and thanks to you for some new ideas I got as well Smile