| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 | 1. Using values from guigetctlplacement #12391 Posted by: Doug Arndt 2008-09-30 00:28:00 Last edited by: Jeff Glatt 2009-03-04 14:10:34 (Total edited 1 time) | When I extract the location of a radio button, using guigetctlplacement, then delete the radio button and then use those values to recreate the radio button, the control isn't in the same place.
Click the "Test Placement" button to demonstrate
LIBRARY rexxgui, rxconsole
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
guigetctlplacement('RadioButton','CCX' ,'CCY' , 'CCWidth', 'CCHeight')
consay(con1,"RadioButton location: " ccx ccy ccwidth ccheight)
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION()
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN
wm_initdialog:
guigetctlplacement('ConBox','ConX' ,'ConY' , 'ConWidth', 'ConHeight')
guiremovectl('ConBox')
concreate('Con1', guiwindow, "CHILD | NODEFAULT",conx, cony, conwidth, conheight)
RETURN ""
wm_click_exitbutton:
guiwake('CLOSE')
RETURN
wm_click_testplacement:
guiremovectl('RadioButton')
consay(con1,"New button created at:" ccx ccy ccwidth ccheight)
guiaddctl("RADIO" ccx"," ccy"," ccwidth"," ccheight", AUTO|GROUP, , RadioButton, , New Radio", , 1)
RETURN Doug | 2. #12396 Posted by: Jeff Glatt 2008-09-30 11:17:16 Last edited by: Jeff Glatt 2008-09-30 11:20:09 (Total edited 1 time) | Sizes/Positions are calculated in two ways on Windows. One way is in raw pixel values. So a width of 100 does in fact mean 100 pixels. But there is also "dialog units", which is what is used in GuiAddCtl, and also the GUI BLOCK. Dialog pixels are scaled according to the font assigned to the window. So if you have 100 dialog units, that may show perhaps about 10 text chars at Courier 8. If you change to Courier 12, now the font is bigger, so in order to show the same number of chars, the control needs to be made bigger. So each dialog unit becomes a larger value. Windows does this so that, if an enduser changes the font on his system, controls will automatically resize to not clip text.
To get dialog units, pass an eighth arg of "SCALE" to GuiGetCtlPlacement:guigetctlplacement("MyCtl", x, y, width, height, , , "Scale") | 3. #12398 | Isn't working for me, RADIO 147, 50, 39, 10, AUTO|GROUP, , RadioButton, , Radio without the "scale" i get 221 81 59 16 with "scale" 221 81 39 10 looks like only the size of the box is affected, not the location.
Still, isn't this more complicated than it should be ? Do I, as a REXX programmer, really want to deal with "raw pixel", "dialog units" etc ? Shouldn't there be a consistancy between all functions so I don't have to care ? And then the "Options" are useful if I want to go into that mess ?Doug | Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
|
|