Page 1 of 1
dialogo resizable desde recursos?
Posted: Tue Jan 28, 2025 4:26 am
by D.Fernandez
Hola amigos:
Estoy buscando unos ejemplos que habían con REDEFINE Dialog.....bla,bla
que se podían cambiar el tamaño incluyendo los elementos incluidos en el dialog.
Esto ya está pronto?
Ya se, estoy medio pesado y perdido, disculpen.
Saludos
Ruben Dario Fernandez
Re: dialogo resizable desde recursos?
Posted: Tue Jan 28, 2025 2:43 pm
by karinha
Re: dialogo resizable desde recursos?
Posted: Tue Jan 28, 2025 6:00 pm
by D.Fernandez
Gracias Joao, pero no es esto.
Incluso Mr. Rao publicó unos ejemplos con animaciones
pero ahora no los encuentro y no se si esta totalmente funcional.
Gracias
Saludos.
Ruben Dario Fernandez
Re: dialogo resizable desde recursos?
Posted: Tue Jan 28, 2025 6:33 pm
by karinha
Esto?
Relative coordinates of Controls:
viewtopic.php?t=44532
Regards, saludos.
Re: dialogo resizable desde recursos?
Posted: Tue Jan 28, 2025 7:19 pm
by D.Fernandez
Siiiiii Joao,
sabes si está funcionando 100 %.?
No logro hacerlo funcionar desde recursos.
Un grande Joao. Gracias.
Saludos
Ruben Dario Fernandez
Re: dialogo resizable desde recursos?
Posted: Wed Jan 29, 2025 8:22 am
by nageswaragunupudi
Please try this sample as it is.
If this works as expected, you may use this for your other dialogs.
Code: Select all | Expand
#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
Code: Select all | Expand
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
Re: dialogo resizable desde recursos?
Posted: Wed Jan 29, 2025 8:34 am
by nageswaragunupudi
Re: dialogo resizable desde recursos?
Posted: Wed Jan 29, 2025 1:58 pm
by karinha
Master Nages, does it work with more complex dialogs with folders, xbrowse, etc?
Master Nages, ¿funciona con cuadros de diálogo más complejos con carpetas, xbrowse, etc?
Gracias, tks.
Regards, saludos.
Re: dialogo resizable desde recursos? SOLUCIONADO?
Posted: Wed Jan 29, 2025 6:52 pm
by D.Fernandez
Hola Mr. Rao.
Excelente, funciona casi de 100%.
Lo probé con un campo MEMO, varios GETs y BTNBMP.
Al restablecer a la forma original el tamaño de las fuentes no lo respeta, quedan mas chicos.
Es un excelente comienzo.
Gracias
Saludos
Ruben Dario Fernandez
Imágen original
https://ibb.co/cSZc87rM
Imágen luego de jugar un poco
https://ibb.co/mCCpz09W
Re: dialogo resizable desde recursos?
Posted: Wed Jan 29, 2025 7:15 pm
by nageswaragunupudi
Mr. Ruben
So, we need to review font resizing and we will look into that aspect.
Please keep using and help us by reporting any issues you notice.
Re: dialogo resizable desde recursos?
Posted: Wed Jan 29, 2025 7:18 pm
by nageswaragunupudi
karinha wrote: Wed Jan 29, 2025 1:58 pm
Master Nages, does it work with more complex dialogs with folders, xbrowse, etc?
Master Nages, ¿funciona con cuadros de diálogo más complejos con carpetas, xbrowse, etc?
Gracias, tks.
Regards, saludos.
xbrowse - yes
folders? No. We need to still improve the logic, to handle folders.
I think you have other alternatives in mind.
Please post one working sample like the one above and we will be glad to learn from that.
Re: dialogo resizable desde recursos?
Posted: Wed Jan 29, 2025 8:09 pm
by D.Fernandez
Si con gusto Mr. Rao.
Gracias
Saludos
Ruben Dario Fernandez
Re: dialogo resizable desde recursos?
Posted: Wed Jan 29, 2025 11:39 pm
by nageswaragunupudi
I gave this function in my original sample
Code: Select all | Expand
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
Please change :oFont:nHeight as :oFont:nInpHeight in both the lines and test again please.
Re: dialogo resizable desde recursos?
Posted: Thu Jan 30, 2025 5:39 am
by D.Fernandez
Mr. Rao...
EXTRAORDINARIO.
Excelente, ya va tomando forma. se ve muy bien.
Saludos
Ruben Dario Fernandez
Re: dialogo resizable desde recursos?
Posted: Thu Jan 30, 2025 2:55 pm
by D.Fernandez
Hola Mr. Rao
Funciona bien con xBrowse
No Funciona el menu del dialogo
Error linea -> xRatio := oDlg:nWidth / oDlg:Cargo[ 1 ] de ResizeCtrls( oDlg )
No funciona la buttonbar
Error linea -> xRatio := oDlg:nWidth / oDlg:Cargo[ 1 ] de ResizeCtrls( oDlg )
Gracias, Saludos
Ruben Dario Fernandez