Popup menu missing the target

Started by James Zukowski, June 28, 2023, 05:40:29 PM

Previous topic - Next topic

James Zukowski

We've got a F/M panel with a menu bar, TitleBar, and 7-tab folder. I'm trying to have a popup menu with variable file-driven data appear in most situations when the user tabs out of a specific field. I've got most of the positioning down, but while the control's 'Col and 'Line positions seem to reflect the accurate position relative to the window, when we apply those coordinates to the popup_menu directive, they seem to try to position the popup relative to the folder's sub-panel. As a result, the popup appear several lines below the control it's supposed to be associated with. I've been able to compensate a bit by subtracting the sub-panel's 'Col and 'Line positions, but that doesn't seem to take into account the TitleBar or menu bar.

Is this a problem with the window building process, or do I need to do these compensations, and how do I determine the heights of the bars?

Thanks in advance!
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Mike King

When you have a folder the screen sets a scroll region around the folder area and as such the 'Col and 'Line will reflect the location relative this scroll region.

If you are popup menu you can generally just omit the location and the system will position the popup_menu below the control that currently being processed or the current mouse position.

Here is a program that you can use to demo this behaviour.

0010 PRINT 'CS',
0020 BUTTON 10,@(10,10,10,10)="Hit me"
0030 CHECK_BOX 11,@(5,5,30,1)="Click here"
0040 MULTI_LINE 12,@(5,8,30,1),MNU=99
0050 WHILE 1
0060 OBTAIN (0,SIZ=1)'BI',*,'EI'
0070 IF CTL=4 OR EOM=ESC THEN BREAK
0080 POPUP_MENU "-[&File,&Edit]",x
0090 WEND





Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

James Zukowski

Mike,
Thanks for the suggestion. It worked just fine the first time. After that, however, the popup was popping up all over creation; other monitor, above/below the window, nowhere to be seen at all but still active.

For the time being, I'm including a calculation fudge factor, but any other suggestions would be warmly welcomed.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services