Please try this sample as it is.
If this works as expected, you may use this for your other dialogs.
#include "fivewin.ch"
function Main()
local oDlg, oFont
local aVar := { PadR( "get1", 10 ), PadR( "edit", 10 ), Space( 10 ), PadR( "pwd", 10 ) }
local aGet[ 4 ]
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg RESOURCE "TESTGETS" FONT oFont
REDEFINE GET aGet[ 1 ] VAR aVar[ 1 ] ID 101
REDEFINE EDIT aGet[ 2 ] VAR aVar[ 2 ] ID 102
REDEFINE EDIT aGet[ 3 ] VAR aVar[ 3 ] ID 103
REDEFINE GET aGet[ 4 ] VAR aVar[ 4 ] ID 104
REDEFINE BUTTON ID 1 ACTION oDlg:End()
REDEFINE BUTTON ID 2 ACTION oDlg:End()
oDlg:bInit := { || SetResize( oDlg ) }
oDlg:bResized := { || ResizeCtrls( oDlg ) }
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
function SetResize( oDlg )
local oCtrl
oDlg:Cargo := { oDlg:nWidth, oDlg:nHeight, oDlg:oFont:nHeight }
for each oCtrl in oDlg:aControls
WITH OBJECT oCtrl
:Cargo := { :nTop, :nLeft, :nWidth, :nHeight, :oFont:nHeight }
END
next
return nil
function ResizeCtrls( oDlg )
local xRatio, yRatio
local oCtrl, h, f
xRatio := oDlg:nWidth / oDlg:Cargo[ 1 ]
yRatio := oDlg:nHeight / oDlg:Cargo[ 2 ]
for each oCtrl in oDlg:aControls
WITH OBJECT oCtrl
:nTop := Int( yRatio * :Cargo[ 1 ] )
:nHeight := Int( yRatio * :Cargo[ 4 ] )
:nLeft := Int( xRatio * :Cargo[ 2 ] )
:nWidth := Int( xRatio * :Cargo[ 3 ] )
h := Int( :Cargo[ 5 ] * yRatio )
if h != :oFont:nInpHeight
:SetFont( f := :oFont:Modify( h ) )
f:End()
endif
END
next
return nil
.RC file
TESTGETS DIALOG 99, 89, 194, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX | WS_MINIMIZEBOX
CAPTION "TESTGETS"
FONT 8, "MS Sans Serif"
{
EDITTEXT 101, 33, 51, 131, 12, WS_BORDER | WS_TABSTOP
EDITTEXT 102, 33, 71, 131, 12, WS_BORDER | WS_TABSTOP
EDITTEXT 103, 33, 91, 131, 12, WS_BORDER | WS_TABSTOP
EDITTEXT 104, 33,111, 131, 12, ES_PASSWORD | WS_BORDER | WS_TABSTOP
DEFPUSHBUTTON "OK", 1, 42, 150, 50, 14
PUSHBUTTON "Cancel", 2, 102, 150, 50, 14
}
Notes:
Please add " WS_THICKFRAME | WS_MAXIMIZEBOX | WS_MINIMIZEBOX" to the dialog styles in the RC file.
Please let us know if you face any issues