EasyPTR question

Anything QL Software or Programming Related.
Post Reply
User avatar
JonS
Bent Pin Expansion Port
Posts: 77
Joined: Fri Nov 11, 2011 3:54 pm
Location: Cumbria

EasyPTR question

Post by JonS »

I know this is a daft question, but I can't get popup menus to appear in a fixed place...I must be missing something obvious...

I have a main window with various buttons and when I click on I want the submenu to appear below the button (loose item). I'm not bothered where it is when interpreted, but want it properly placed in the final compiled code.

MDRAW#c%,menuname,14,50

I assumed this would put the submenu x=14 and y=50 pixels from the origin of the main window.

I'm sure it's obvious what the problem is, just point me at it please!


User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: EasyPTR question

Post by tofro »

JonS wrote:I know this is a daft question, but I can't get popup menus to appear in a fixed place...I must be missing something obvious...

I have a main window with various buttons and when I click on I want the submenu to appear below the button (loose item). I'm not bothered where it is when interpreted, but want it properly placed in the final compiled code.

MDRAW#c%,menuname,14,50

I assumed this would put the submenu x=14 and y=50 pixels from the origin of the main window.

I'm sure it's obvious what the problem is, just point me at it please!

JonS,
this is not decided at run-time by the SuperBASIC code, but instead at definition time in EasyMenu. Thus it depends on how you save the Menu definition when you save in EasyMenu:
  • If "Fixed" is selected in the "Save" dialog, the menu will (if primary) appear exactly at the defined screen cordinates that it had in EasyMenu. If it's a secondary, it will appear at the defined position relative to its primary. So - If you want your menu to show up 10 pixels rigt and 10 pixels down of your primary, you need to position it 10 pixels right and 10 pixels down from the screen edges in EasyMenu
  • If "Relative", the menu will be positioned around the pointer position given in EasyMenu - While trying to leave the pointer where it was.
As "Relative" is the default, I guess you forgot to check "Fixed" before saving your menu definition.

All this positioning is a bit more complicated if the menu will not fit at runtime where you want it to go - The pointer environment will make sure your menu fits onto the screen and push it around until it does.

Hope this helps,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
JonS
Bent Pin Expansion Port
Posts: 77
Joined: Fri Nov 11, 2011 3:54 pm
Location: Cumbria

Re: EasyPTR question

Post by JonS »

Tobias

Just to make sure I am clear on what you have said...when you say position it at 10, 10 do you mean as in MDRAW#c,menu,10,10 or setting it somewhere in menu designer?

Jon


User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: EasyPTR question

Post by tofro »

Jon,

Positioning depends on two things:

1. Position of your window within EasyPtr's primary window - That is the offset that can be overridden with giving x, y positions to the MDRAW command.

2. The option chosen in the save dialog when saving the design - "Fixed": absolute within parent window for secondaries - "Relative": Relative to mouse pointer

If you're not "hitting the spot" with your Basic command, I guess the design was saved as "Relative" - So, the "save" mode is the more important setting, because then the MDRAW coordinates will just move your window relative to the pointer, which can basically be anywhere....


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
JonS
Bent Pin Expansion Port
Posts: 77
Joined: Fri Nov 11, 2011 3:54 pm
Location: Cumbria

Re: EasyPTR question

Post by JonS »

Clearly I'm doing something wrong.

My code has the position set as follows:
2260 IF Q_MYJOB THEN
2270 MDRAW#drop%,"EZPFILES",14,50
2280 ELSE
2290 MDRAW#drop%,win1_dev_ezpfiles_men,14,50
2300 END IF

The menu has been saved with FIXED selected and appended to the relevant appman file and picked up by QLIB. Strangely, each time I load the menu in EasyMenu it says "relative", even though fixed was selected before saving...


Post Reply