Prev: Thanks and Happy New Year
Next: GZip compression
From: Kuno on 20 Dec 2009 23:05 Does anyone know why the following code does not center the dialog? oOD := OpenDialog{SELF, "???inv.dbf"} oOD:Caption := "SELECT AN INVENTORY" oOD:SetStyle(OFN_HIDEREADONLY) oOD:Show(SHOWCENTERED) The dialog remains stuck in the upper left corner of the screen. I'm using 2.8 SP3 on Vista. Any advice would be appreciated. Kuno
From: Geoff Schaller on 21 Dec 2009 00:04 Kuno, You should check the SDK. The Show method does not take a parameter. If you need to position the dialog yourself then you are going to have to do some low level coding. Geoff "Kuno" <kuno(a)retailsoftware.com> wrote in message news:2fe6fc8e-d6c6-4094-8e86-bc3069b56ec3(a)b36g2000prf.googlegroups.com: > Does anyone know why the following code does not center the dialog? > > oOD := OpenDialog{SELF, "???inv.dbf"} > oOD:Caption := "SELECT AN INVENTORY" > oOD:SetStyle(OFN_HIDEREADONLY) > oOD:Show(SHOWCENTERED) > > The dialog remains stuck in the upper left corner of the screen. I'm > using 2.8 SP3 on Vista. Any advice would be appreciated. > > Kuno
From: Fred Killet on 21 Dec 2009 06:47 Hi Kuno, here is the code to center your dialog on the screen: FUNCTION fenZentrieren(oWindow) AS VOID // Zentriert ein Fenster oWindow auf dem Bildschirm. // Variablen LOCAL nScreenX,nScreenY,nWindowX,nWindowY,nWeite,nHoehe AS SHORTINT // Fenster zentrieren nWeite := oWindow:size:width nHoehe := oWindow:size:height nWindowX := nWeite / 2 nWindowY := nHoehe / 2 nScreenX := GetSystemMetrics(SM_CXSCREEN) / 2 nScreenY := GetSystemMetrics(SM_CYSCREEN) / 2 MoveWindow(oWindow:handle(),nScreenX - nWindowX,nScreenY - nWindowY,nWeite,nHoehe,FALSE) RETURN Kind regards, Fred -- Fred Killet killet-nospam(a)killetsoft.de
From: Kuno on 21 Dec 2009 23:12 Fred, Thank you for the code example. When I call it using: oOD := OpenDialog{SELF, "???inv.dbf"} oOD:Caption := "SELECT AN INVENTORY" oOD:SetStyle(OFN_HIDEREADONLY) fenZentrieren(oOD) oOD:Show() It generates an error at: nWeite := oWindow:size:width The error is no exported variable.
From: Geoff Schaller on 22 Dec 2009 02:15
There was a small mistake in Fred's code because these objects are not VO objects. In fact, it would be better to use SetWindowPos() Instead, ignore height and width and instead use the correct defines for no resize. To find the define, look up the Win32SDK SetWindowPos() where all the defines are neatly laid out. From memory it is SWP_NOSIZE. Geoff "Kuno" <kuno(a)retailsoftware.com> wrote in message news:928adeda-b77f-4837-b0a3-fe5d55c1f73d(a)z4g2000prh.googlegroups.com: > Fred, > > Thank you for the code example. When I call it using: > > oOD := OpenDialog{SELF, "???inv.dbf"} > oOD:Caption := "SELECT AN INVENTORY" > oOD:SetStyle(OFN_HIDEREADONLY) > fenZentrieren(oOD) > oOD:Show() > > > It generates an error at: > > nWeite := oWindow:size:width > > The error is no exported variable. |