Change position of Modal Dialog?
Change position of Modal Dialog?
Hi my friends!
How I can change the position ( Top and Left ) of a modal dialog at runtime?
It's possible?
Thanks for all!
How I can change the position ( Top and Left ) of a modal dialog at runtime?
It's possible?
Thanks for all!
Peace and lighting!
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Antonio Linares wrote:Julio,
oDlg:nTop = ...
oDlg:nLeft = ...
First, thanks Antonio...
This is my situation:
Code: Select all
DEFINE DIALOG oDlg RESOURCE "GRID_SELECTION" OF oDlgP
...
ACTIVATE DIALOG oDlg ON INIT ( oDlg:move( oDlgP:nTop, oDlgP:nLeft,,, .T. ) )
I want this: the dialog oDlg get the bottom and left position of the oDlgP!
Peace and lighting!
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
- Biel EA6DD
- Posts: 680
- Joined: Tue Feb 14, 2006 9:48 am
- Location: Mallorca
- Contact:
Hello Cesar,
maybe you can try with
oDlg:Move(20,20,700,800,.t.)
Regards,
Otto
maybe you can try with
oDlg:Move(20,20,700,800,.t.)
Regards,
Otto
Code: Select all
//
//DEFINE DIALOG oDlg RESOURCE "GRID_SELECTION" OF oDlgP
//...
//ACTIVATE DIALOG oDlg ON INIT ( oDlg:move( oDlgP:nTop, oDlgP:nLeft,,, .T. ) )
//EMG
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oBtn
LOCAL oGet1, oGet2
LOCAL cVar1 := SPACE( 30 )
LOCAL cVar2 := SPACE( 60 )
DEFINE DIALOG oDlg
@ 1, 1 GET oGet1 VAR cVar1
@ 1, 1 GET oGet2 VAR cVar2
@ 3, 1 BUTTON oBtn PROMPT "Scientific";
ACTION CHANGE( oDlg, oBtn, oGet1, oGet2 )
ACTIVATE DIALOG oDlg;
ON INIT oGet2:Hide()
RETURN NIL
STATIC FUNCTION CHANGE( oDlg, oBtn, oGet1, oGet2 )
IF oBtn:GetText() = "Scientific"
oDlg:SetSize( 500, , .T. )
oDlg:Move(200,300,700,800,.t.)
oBtn:SetText( "Standard" )
oGet1:Hide()
oGet2:Show()
ELSE
oDlg:SetSize( 300, , .T. )
oDlg:Move(20,20,700,800,.t.)
oBtn:SetText( "Scientific" )
oGet1:Show()
oGet2:Hide()
ENDIF
RETURN NIL
Otto wrote:Hello Cesar,
maybe you can try with
oDlg:Move(20,20,700,800,.t.)
Regards,
Otto
Code: Select all
// //DEFINE DIALOG oDlg RESOURCE "GRID_SELECTION" OF oDlgP //... //ACTIVATE DIALOG oDlg ON INIT ( oDlg:move( oDlgP:nTop, oDlgP:nLeft,,, .T. ) ) //EMG #include "Fivewin.ch" FUNCTION MAIN() LOCAL oDlg, oBtn LOCAL oGet1, oGet2 LOCAL cVar1 := SPACE( 30 ) LOCAL cVar2 := SPACE( 60 ) DEFINE DIALOG oDlg @ 1, 1 GET oGet1 VAR cVar1 @ 1, 1 GET oGet2 VAR cVar2 @ 3, 1 BUTTON oBtn PROMPT "Scientific"; ACTION CHANGE( oDlg, oBtn, oGet1, oGet2 ) ACTIVATE DIALOG oDlg; ON INIT oGet2:Hide() RETURN NIL STATIC FUNCTION CHANGE( oDlg, oBtn, oGet1, oGet2 ) IF oBtn:GetText() = "Scientific" oDlg:SetSize( 500, , .T. ) oDlg:Move(200,300,700,800,.t.) oBtn:SetText( "Standard" ) oGet1:Hide() oGet2:Show() ELSE oDlg:SetSize( 300, , .T. ) oDlg:Move(20,20,700,800,.t.) oBtn:SetText( "Scientific" ) oGet1:Show() oGet2:Hide() ENDIF RETURN NIL
Yes, I tried! But this is the problem.... is a Dialog opened from another Dialog... the value must be from the first Dialog, but it get a value of top and left from the main window! I'm crazy, that's it!!!
Really, I want one thing: The second dialog must be show exactly on top of first dialog, with top and left!
Peace and lighting!
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Cesar,
I think you are right. There is no function opposite to the SetWindowPos = GetWindowPos in FIVEWIN.
oDlg:nTop() returns 0 in my tests
@ 3, 16 BUTTON "Top" SIZE 40, 12 ACTION msginfo(oDlg:nTop())
Maybe you can store the nTop of the first DIALOG in a STATIC and then use this STATIC for the second DIALOG. If you move the first you must change the STATIC VAR too.
Regards,
Otto
I think you are right. There is no function opposite to the SetWindowPos = GetWindowPos in FIVEWIN.
oDlg:nTop() returns 0 in my tests
@ 3, 16 BUTTON "Top" SIZE 40, 12 ACTION msginfo(oDlg:nTop())
Maybe you can store the nTop of the first DIALOG in a STATIC and then use this STATIC for the second DIALOG. If you move the first you must change the STATIC VAR too.
Regards,
Otto
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Cesar,
maybe this is what you need.
Regards,
Otto
maybe this is what you need.
Regards,
Otto
Code: Select all
#include "fivewin.ch"
STATIC nTop, nLeft
STATIC oWnd
function main()
local oWnd
DEFINE WINDOW oWnd TITLE "oWnd1" ;
FROM 5, 5 TO 24, 64
ACTIVATE WINDOW oWnd on Init f_dlg()
return nil
func f_dlg
local oDlg, oIco, cTest := "Hello world! "
local nTop
DEFINE ICON oIco FILE "..\icons\fivewin.ico"
DEFINE DIALOG oDlg TITLE "I am a DialogBox" COLOR "W+/B" ;
ICON oIco of Ownd
@ 1, 3 GET cTest
@ 3, 5 BUTTON "Ok" SIZE 40, 12 ;
ACTION ( xCheck( oDlg ), f_dlg2() ) DEFAULT
ACTIVATE DIALOG oDlg CENTERED ;
VALID MsgYesNo( "Do you want to end ?" )
return nil
function xCheck( oDlg )
local aPoint := { 0, 0 }
aPoint = ClientToScreen( oDlg:hWnd, aPoint )
if aPoint[ 1 ] > 32768
aPoint[ 1 ] -= 65535
endif
if aPoint[ 2 ] > 32768
aPoint[ 2 ] -= 65535
endif
nTop:= aPoint[ 1 ] - 20
nLeft:= aPoint[ 2 ]
//msginfo(STR(nTop) + " " +str(nLeft) )
return nil
func f_dlg2()
local oDlg, oIco, cTest := "Hello world! "
DEFINE DIALOG oDlg TITLE "I am a DialogBox" of oWnd
@ 3, 5 BUTTON "&Ok" SIZE 40, 12 ;
ACTION oDlg:End() DEFAULT
ACTIVATE DIALOG oDlg ON INIT oDlg:Move(nTop,nLeft,,,.t.)
return nil
Yes Antonio.... with ScreenToClient() , It's work fine!Antonio Linares wrote:Julio,
You need to turn absolute coordinates into relative ones.
Please review function ScreenToClient()
Please make a search for ScreenToClient in these forums. There are several examples of its use
Otto, thanks too!
Thanks very much! With much strenght!!
Peace and lighting!
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Júlio César M. Ferreira
FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9