LAYOUT(DlgLayout, 260, 83) ITEM(EditField, Point1, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 200).TopPosZ(0, 16)) ITEM(EditField, Point2, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 200).TopPosZ(16, 16)) ITEM(EditField, Angle1, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 96).TopPosZ(32, 16)) ITEM(EditField, Angle2, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(149, 96).TopPosZ(32, 16)) ITEM(EditField, Distance, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 96).TopPosZ(48, 16)) ITEM(Label, units, SetFont(StdFontZ(12).Bold()).LeftPosZ(138, 30).TopPosZ(48, 16)) ITEM(Label, dv___6, SetLabel(t_(" Point 1")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).VSizePosZ(0, 67)) ITEM(Label, dv___7, SetLabel(t_(" Point 2")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).TopPosZ(16, 16)) ITEM(Label, dv___8, SetLabel(t_(" Angle 1")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).TopPosZ(32, 16)) ITEM(Label, dv___9, SetLabel(t_("2")).LeftPosZ(142, 8).TopPosZ(32, 16)) ITEM(Label, dv___10, SetLabel(t_(" Distance")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).TopPosZ(48, 16)) ITEM(EditField, Data1, WantFocus(false).LeftPosZ(1, 255).TopPosZ(64, 16)) ITEM(Button, P1, SetLabel(t_("<")).SetFont(StdFont().Bold()).LeftPosZ(244, 16).TopPosZ(0, 16)) ITEM(Button, P2, SetLabel(t_("<")).SetFont(StdFont().Bold()).LeftPosZ(244, 16).TopPosZ(16, 16)) ITEM(EditField, count, AlignRight(true).SetFont(StdFont().Bold()).WantFocus(false).LeftPosZ(208, 52).TopPosZ(48, 16)) ITEM(EditField, timezone, AlignRight(true).SetFont(StdFont().Bold()).WantFocus(false).LeftPosZ(184, 24).TopPosZ(48, 16)) END_LAYOUT
Didier wrote on Mon, 22 April 2013 11:17 |
I expect the dialog to STAY 320*240 |
Didier wrote on Mon, 22 April 2013 11:17 |
I expect the dialog to STAY 320*240 |
#include <CtrlLib/CtrlLib.h> using namespace Upp; GUI_APP_MAIN { RDUMP(GetStdFont()); Font fnt; fnt.FaceName("Tahoma").Height(15); SetStdFont(fnt); PromptOK("Hello World!"); }
#include <CtrlLib/CtrlLib.h> using namespace Upp; GUI_APP_MAIN { PromptOK("With layout zoom"); Ctrl::NoLayoutZoom(); PromptOK("No layout zoom"); }
/home/neil/MyApps/NefbG2/NefbG2.cpp:26:21: error: ISO C++ forbids declaration of ‘NoLayoutZoom’ with no type [- fpermissive] /home/neil/MyApps/NefbG2/NefbG2.cpp:26:21: error: cannot declare member function ‘Upp::Ctrl::NoLayoutZoom’ with in ‘NefbG2’
GUI_APP_MAIN{ Ctrl::NoLayoutZoom(); NefbG2().Run(); endX(); }
piotr5 wrote on Thu, 09 May 2013 02:34 |
as far as I know in wine 96 is the default dpi no matter where... |
#include <CtrlLib/CtrlLib.h> using namespace Upp; GUI_APP_MAIN { EditString text, zoomedText; text.NullText("Normal"); zoomedText.NullText("Zoomed"); TopWindow window; window.SetRect(Size(320, 240)); window.Add(text.LeftPos(4, 100).TopPos(4, 20)); // Without Z suffix window.Add(zoomedText.LeftPosZ(4, 100).TopPosZ(28, 20)); window.Run(); }
#ifdef PLATFORM_X11 class MainWindow : public WithMainWindowLayoutX11 { #else class MainWindow : public WithMainWindowLayout { #endif
ChClassicSkin ();
window.Add(text.LeftPos(4, 100).TopPos(4, 20)); // Without Z suffix
window.Add(text.LeftPos(4, 100).TopPos(4, 20)); // Without Z suffix }
Logical positions |
Another issue that is related to positions is layout zooming. The problem here is that application can use font of different size or type than standard one used in layout designer when designing layout. That is why layout logical position need to be zoomed. Zoom factor is determined by ratio of text "OK Cancel Exit Retry" in runtime standard font size to Size(99, 13) - size of this text using standard font. Zooming layout positions is done using placement methods with Z suffix (like LeftPosZ etc...). |
l1.SetLabel(t_(" Point 1")).SetFont(StdFont(11));
l1.SetLabel(t_(" Something")).SetFont(StdFont(11));
Sender Ghost wrote on Wed, 29 May 2013 02:45 |
If you want to use placement methods without Z suffix, you could use them manually (as I already said): Label units, l1, l2, l3, l4, l5; Add(l1.LeftPos(0, 44).VSizePos(0, 67)); l1.SetLabel(t_(" Point 1")).SetFont(StdFont(11)); Add(l2.LeftPos(0, 44).TopPos(16, 16)); l2.SetLabel(t_(" Point 2")).SetFont(StdFont(11)); |
l1.SetLabel(t_(" Point 1")).SetFont(StdFont(11));
l1.SetLabel(t_(" Something")).SetFont(StdFont(11));
bool check = true; Label l1; l1.SetFont(StdFont(11)); // l1.SetLabel(t_(check ? " Point 1" : " Something")); // or as external function, void ChangeLabel(bool check = true): if (check) l1.SetLabel(t_(" Point 1")); else l1.SetLabel(t_(" Something"));
ITEM(Label, dv___6, SetLabel(t_(" Point 1")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).VSizePosZ(0, 67))
dv___6.SetLabel(t_(" Something");
Label l1, l2, l3, l4, l5;