EASYPTR4 - Minimum menu size
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
EASYPTR4 - Minimum menu size
When you draw a menu with Easymenu, that design is the minimum size of the menu.
I can not make it smaller by SBASIC, using MDRAW command.
Now, is there any way to read this minimum size of the menu? The manual I could not find anything useful, but my English is bad and probably escaped me.
Thanks in advanced
Giorgio
I can not make it smaller by SBASIC, using MDRAW command.
Now, is there any way to read this minimum size of the menu? The manual I could not find anything useful, but my English is bad and probably escaped me.
Thanks in advanced
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: EASYPTR4 - Minimum menu size
Giorgio,
to my knowledge, there is no S*BASIC command to retrieve menu sizes. You should, however, be able to install the menu using MSETUP, get its address using MWDEF and then PEEK_W the sizes directly from the menu definition.
Window size (width and height) and desired origin are the first two words after the header block in the working definition (offset $20 and $22). Note this is the inner size of the window, i.e. without taking account of the border width. Have a look into the QPTR manual to find the structure of a window working definition.
Tobias
to my knowledge, there is no S*BASIC command to retrieve menu sizes. You should, however, be able to install the menu using MSETUP, get its address using MWDEF and then PEEK_W the sizes directly from the menu definition.
Window size (width and height) and desired origin are the first two words after the header block in the working definition (offset $20 and $22). Note this is the inner size of the window, i.e. without taking account of the border width. Have a look into the QPTR manual to find the structure of a window working definition.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: EASYPTR4 - Minimum menu size
Maybe I can use the command MSETUP ?
PVAL of the command values are already ' updated or are updated only after the MDRAW command ?
( I do not QPTR )
Giorgio
PVAL of the command values are already ' updated or are updated only after the MDRAW command ?
( I do not QPTR )
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: EASYPTR4 - Minimum menu size
Giorgio,
surely you can (and should) use MSETUP. MDRAW will try to draw the menu. If you, for example, want to find out whether the menu is too large for the current screen resolution, that will already be too late and your program will have stopped with an error message "OUT OF RANGE" already... Note, to my knowledge, neither MDRAW nor MSETUP will fill the pointer array retrieved with PVAL with any useful value. That is not done until MCALL is called.
Something along the lines of the following should work (just checked - seems to work):
Note you might want to do this on a dummy channel opened with FOPEN - If you do it with #0, any other attempt to MSETUP or MDRAW a menu to #0 will be rejected with an "Already exists" error message. The dummy channel you simply CLOSE.
Tobias
surely you can (and should) use MSETUP. MDRAW will try to draw the menu. If you, for example, want to find out whether the menu is too large for the current screen resolution, that will already be too late and your program will have stopped with an error message "OUT OF RANGE" already... Note, to my knowledge, neither MDRAW nor MSETUP will fill the pointer array retrieved with PVAL with any useful value. That is not done until MCALL is called.
Something along the lines of the following should work (just checked - seems to work):
Code: Select all
1000 MSETUP #ch,menu_name$
1010 wwdef = MWDEF(#ch)
1020 width = PEEK_W (wwdef + 32)
1030 height = PEEK_W (wwdef + 34)
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: EASYPTR4 - Minimum menu size
this solution does not work or, rather, does not do what it takes to me.
the two values that returns are the current size to me instead need to know what 's the minimum possible size of a menu.
This information must be somewhere, because when seeking to reduce the size of the finetra never goes below a certain extent.
Giorgio
the two values that returns are the current size to me instead need to know what 's the minimum possible size of a menu.
This information must be somewhere, because when seeking to reduce the size of the finetra never goes below a certain extent.
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: EASYPTR4 - Minimum menu size
What you get with this method is the preferred size of the window - i.e the one it would open initially. The minimum size of a window as you refer to it is not part of the window working definition - It is determined by the resizing code setting a minimum limit and and cannot be easily PEEKed from somewhere (Simply, because it's in code and not in data).
This is valid for freely scalable windows. "Old-style" window definitions could only define multiple differently sized, preconfigured and non-scalable layouts. The Pointer Environment would choose the one it thinks fits best to your screen resolution. The size of window definitions that contain multiple layouts cannot, to my knowledge, retrieved with EasyPtr from the window definition. EasyPtr gives you access to the window working definition, the multiple layouts form the window definition - EasyPtr doesn't have a function to return the latter one.
So, what I have given you above is probably the best you can get without re-engineering the EasyPtr file format.
Tobias
This is valid for freely scalable windows. "Old-style" window definitions could only define multiple differently sized, preconfigured and non-scalable layouts. The Pointer Environment would choose the one it thinks fits best to your screen resolution. The size of window definitions that contain multiple layouts cannot, to my knowledge, retrieved with EasyPtr from the window definition. EasyPtr gives you access to the window working definition, the multiple layouts form the window definition - EasyPtr doesn't have a function to return the latter one.
So, what I have given you above is probably the best you can get without re-engineering the EasyPtr file format.
Tobias
Last edited by tofro on Fri Aug 05, 2016 11:12 pm, edited 1 time in total.
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: EASYPTR4 - Minimum menu size
I do not think so.
Each time you resize the window gives me a different pair of values; if they were the preferred size should have the constant values ...
Each time you resize the window gives me a different pair of values; if they were the preferred size should have the constant values ...
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: EASYPTR4 - Minimum menu size
Maybe I was not clear enough - It's the size the window was defined with and the size the window will open initially - As soon as it's on screen and you resize the window, it will follow the change.
Tobias
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: EASYPTR4 - Minimum menu size
OK.. now is clear...tofro wrote:Maybe I was not clear enough - It's the size the window was defined with and the size the window will open initially - As soon as it's on screen and you resize the window, it will follow the change.
Tobias
thanks
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: EASYPTR4 - Minimum menu size
Hi Giorgio,
I sent a reply to ql-users, but it takes forever for my mails to arrive there, so I'll copy it here, in case you need this info now:
Well, then you need to PEEK the window definition [WD] rather than the window working definition [WWD]. EasyPtr prepends its own header to the WD. I think its always 28b long, in which case the standard/minimum size can be found at
WD = APPA(<menu name>)
minx = PEEK_W(WD + 28): miny = PEEK_W(WD + 30)
This is not a universal formula, mind you, as more than one layout may be defined (the menu designer will know). However, I'll leave that as an excercise for now.. Check out the excellent QPTR manual for details, and use EasySource to dissemble your EasyMen menus.
Per
I sent a reply to ql-users, but it takes forever for my mails to arrive there, so I'll copy it here, in case you need this info now:
Well, then you need to PEEK the window definition [WD] rather than the window working definition [WWD]. EasyPtr prepends its own header to the WD. I think its always 28b long, in which case the standard/minimum size can be found at
WD = APPA(<menu name>)
minx = PEEK_W(WD + 28): miny = PEEK_W(WD + 30)
This is not a universal formula, mind you, as more than one layout may be defined (the menu designer will know). However, I'll leave that as an excercise for now.. Check out the excellent QPTR manual for details, and use EasySource to dissemble your EasyMen menus.
Per
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen