Last Row of Dialog (Resource)

Last Row of Dialog (Resource)

Postby ericmagaldi » Thu Apr 19, 2007 4:58 am

Como saber a linha inferior do Dialog (Resource), para poder inserir botões no rodapé ?
@nLastRow - 30, 50 Button ...

Ex:
Code: Select all  Expand view
//------------------------------------------------------------------------------
function DlgMain()
local oDlgMain

Define Dialog oDlgMain NAME 'CDT_CLIENTE' TITLE 'CADASTRO CLIENTE'
Activate Dialog oDlgMain ;
         On Init OnInitMain(oDlgMain) ;
         Valid OnExitMain(oDlgMain) ;
         Center

return nil

//------------------------------------------------------------------------------
function OnInitMain(oDlgMain)
oDlgMain:lHelpIcon:=.f.

@378,410 button '&Gravar'   of oDlgMain Size 60,23 Pixel
@378,480 button '&Cancelar' of oDlgMain Size 60,23 Pixel
// 378, não poderia estar fixo, algo parecido oDlgMain:nBotton - 30
return nil

Last edited by ericmagaldi on Thu Apr 19, 2007 4:43 pm, edited 1 time in total.
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Thu Apr 19, 2007 11:47 am

Eric,

@ oDlgMain:nHeight - 30, 50 Button ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41319
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ericmagaldi » Thu Apr 19, 2007 2:21 pm

Antonio,

hehe

isso foi a primeira coisa que fiz, além de outras propriedades básicas.

Montei uma rotina pra listar todos, métodos e propriedades da Classe, e percebi que não há nenhuma variável de instância que tenha esta informação.

Quando observei os valores de todas as propriedades, também considerei o fato deste número necessitar ser dividido ou multiplicado.

Também tentei GetCoors (oDlgMain).
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Thu Apr 19, 2007 3:59 pm

Eric,

No te funciona oDlgMain:nHeight ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41319
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ericmagaldi » Thu Apr 19, 2007 4:09 pm

Não funciona..

conforme comentei.. não há nenhuma variavel de instância nesta classe que tem o valor correto, para eu usar como base.
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Thu Apr 19, 2007 4:43 pm

Eric,

Please try this sample, thanks
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT MsgInfo( oDlg:nHeight )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41319
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ericmagaldi » Thu Apr 19, 2007 5:14 pm

Fiz o teste que pediu, lembrando que uso o Dialog via Resouce e o Button via @...

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()
local oDlg

DEFINE DIALOG oDlg

ACTIVATE DIALOG oDlg CENTERED ;
                ON INIT DlgOnInit(self)

return nil

//-----------------------------------------------------------------------------------
function DlgOnInit(Self)
? ::nHeight // 184
? ::nWidth  // 324
? ::nTop    // 0
? ::nBottom // 151

// 130, esta aparecendo no rodapé, conforme desejado.
@130,10 Button 'OK' of self Size 60,23 Pixel
return nil
Last edited by ericmagaldi on Thu Apr 19, 2007 6:02 pm, edited 1 time in total.
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Thu Apr 19, 2007 5:22 pm

Eric,
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg SIZE 400, 200

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT PlaceControl( oDlg )

return nil

function PlaceControl( oDlg )

   @ oDlg:nHeight - 60, 20 BUTTON "Ok" PIXEL SIZE 80, 20
   
return nil

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41319
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ericmagaldi » Thu Apr 19, 2007 6:01 pm

Realmente é um bonito dialogo que montou e funciona a contento.

Por favor, observe os números, e como eu disse, uso RESOURCE.

Code: Select all  Expand view
function DlgMain()
local oDlgMain

// Definição no .RC (Pelles C) Width = 370, Height = 250

Define Dialog oDlgMain NAME 'CDT_CLIENTE'
...
...
Activate Dialog oDlgMain ;
         On Init OnInitMain(oDlgMain) ;
         Center

return nil
//---------------------------------------------------------------------

function OnInitMain(Self)

? ::nHeight // 438
? ::nWidth  // 561
? ::nTop    // 0
? ::nBottom // 151

@378,410 button '&Gravar'   of Self Size 60,23 Pixel ...
@378,480 button '&Cancelar' of Self Size 60,23 Pixel ...

return nil



::nHeight - 30 = 408, se eu linha acima de 378, o botão não aparecerá.

Assim o botão ficará escondido.
@::nHeight-30,410 button '&Gravar' of Self Size 60,23 Pixel ...

Claro que se eu subtrair com um número bem maior que 30, funcionará, mas qual seria a lógica disso ?!

Please Antonio, help-me.
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Thu Apr 19, 2007 8:11 pm

Eric,

> // Definição no .RC (Pelles C) Width = 370, Height = 250

Those values are logical units, not pixels

>>
The GetDialogBaseUnits function returns the dialog box base units used by Windows to create dialog boxes. Both Windows and applications use these units to convert the width and height of dialog boxes and controls from dialog units, as given in dialog box templates, to pixels, and vice versa.

LONG GetDialogBaseUnits(VOID)


Parameters

This function has no parameters.

Return Values

The return value is a 32-bit value that contains the dialog base units. The low-order word of the return value contains the horizontal dialog box base unit, and the high-order word contains the vertical dialog box base unit.

Remarks

The horizontal base unit is equal to the average width, in pixels, of the characters in the system font; the vertical base unit is equal to the height, in pixels, of the font. Furthermore, each horizontal base unit is equal to 4 horizontal dialog units; each vertical base unit is equal to 8 vertical dialog units. Therefore, to convert dialog units to pixels, an application applies the following formulas:

pixelX = (dialogunitX * baseunitX) / 4
pixelY = (dialogunitY * baseunitY) / 8


Similarly, to convert from pixels to dialog units, an application applies the following formulas:

dialogunitX = (pixelX * 4) / baseunitX
dialogunitY = (pixelY * 8) / baseunitY


The multiplication is performed before the division to avoid rounding problems if base units are not divisible by 4 or 8.
>>
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41319
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 15 guests

cron