Author | Topic: Re: Enable Menu Options | |
---|---|---|
Andreas Gehrs-Pahl View the complete thread for this message in: | Re: Enable Menu Options on Wed, 21 Jan 2015 20:31:11 -0500 Carlos, The reason why your code doesn't seem to have any effect is the order in which you remove the Menu Items. You must always remove them from the bottom up -- removing the highest numbered (or last) Menu Item first. Changing your code as follows, will remove the listed System Menu Items, and will also gray-out (and disable) the [X] Close button. But the ALT + F4 functionality and the other two buttons (Min/Max) will still work. ApiTitleOptions_(oDlg, cabWIN_CLOSEBUTTON, .t.) ApiTitleOptions_(oDlg, cabWIN_ITEM_SEPARATOR, .t.) ApiTitleOptions_(oDlg, cabWIN_MAXBUTTON, .t.) ApiTitleOptions_(oDlg, cabWIN_MINBUTTON, .t.) The reason for this is simple: When you remove a Menu Item, the remaining Menu Items will be re-numbered. So if you remove Item 3, then Item 4 will become Item 3, etc. So your original code removed first Item 3 (the Minimize option), then Item 4 (which was then the Item Separator), and then Item 5, which by then didn't existed anymore. So the Maximize and Close Menu options both remained in the menu. The following code will do the same as above -- removing the last four menu items -- but it looks a little stranger: for nItem := 1 to 4 ApiTitleOptions_(oDlg, cabWIN_MINBUTTON, .t.) next Rather than removing those System Menu Items, you might as well create the Dialog without the Min/Max and/or Close buttons from the beginning, and/or remove the System Menu completely, using the appropriate XppDialog iVars. For example, using the following: oDlg:MinButton := .f. oDlg:MaxButton := .f. oDlg:Configure() will remove the Min/Max buttons and gray-out the corresponding System Menu Items. This would be considered Standard Windows Behavior, and preferable to your method. Hope that helps. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net web: http://www.Aerospace-History.net |