Alaska Software Inc. - XbpCheckBox:autosize
Username: Password:
AuthorTopic: XbpCheckBox:autosize
Carlos A Beling XbpCheckBox:autosize
on Wed, 12 Aug 2020 19:09:59 -0300
Hello:
Good night.

I am creating a XbpCheckBox() like this:
        ::oCaseBox                    := XbpCheckBox():new(::oBox, 
::oBox, NIL, NIL, aPPDialog)
        ::oCaseBox:autoSize           := .t.
        ::oCaseBox:caption            := "Maiúsculas/Minúsculas"
        ::oCaseBox:selection          := .f.
        ::oCaseBox:pointerFocus       := .f.
        ::oCaseBox:tabStop            := .t.
AppDialog is {{XBP_PP_COMPOUNDNAME, '12.Segoe Ui'}}
::oCaseBox is created with ::oCaseBox:create()

XbpCheckBox() seems consider font size for to create and align the 
button area.
Please see the attach.

What is going wrong?

Fraternally
Beling


! Checkbox.png
Andreas Gehrs-Pahl
Re: XbpCheckBox:autosize
on Thu, 13 Aug 2020 18:29:12 -0400
Carlos,

>XbpCheckBox() seems consider font size for to create and align the 
>button area.

This is described in (the still open) PDR 109-4205:

https://www.alaska-software.com/scripts/waa001.dll?WAA_PACKAGE=PUBLICDTS&WAA_FORM=DISPLAYPDR&PDRID=4205

The workaround for this is to manually calculate the caption's size, using 
the GraQueryTextBox() function and to set the calculated size explicitly.

LOCAL cCaption := "Maiusculas/Minusculas", nCBWidth, aTextBox
   ::oCaseBox := XbpCheckBox():New(::oBox, , , , aPPDialog)
   ::oCaseBox:AutoSize     := .t.
   ::oCaseBox:Selection    := .f.
   ::oCaseBox:PointerFocus := .f.
   ::oCaseBox:TabStop      := .t.
   ::oCaseBox:Create()
   nCBWidth := oXbp:CurrentSize()[1]
   aTextBox := GraQueryTextBox(oXbp:LockPS(), cCaption)
   oXbp:UnLockPS()
   oXbp:SetCaption(cCaption)
   oXbp:SetSize({nCBWidth + aTextBox[3, 1], aTextBox[3, 2]})

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Andreas Gehrs-Pahl
Re: XbpCheckBox:autosize
on Thu, 13 Aug 2020 18:37:01 -0400
Carlos,

Some minor corrections, to always use your variable name "::oCaseBox", 
instead of the generic "oXbp" variable that I used:
 
LOCAL cCaption := "Maiusculas/Minusculas", nCBWidth, aTextBox
    ::oCaseBox := XbpCheckBox():New(::oBox, , , , aPPDialog)
    ::oCaseBox:AutoSize     := .t.
    ::oCaseBox:Selection    := .f.
    ::oCaseBox:PointerFocus := .f.
    ::oCaseBox:TabStop      := .t.
    ::oCaseBox:Create()
    nCBWidth := ::oCaseBox:CurrentSize()[1]
    aTextBox := GraQueryTextBox(::oCaseBox:LockPS(), cCaption)
    ::oCaseBox:UnLockPS()
    ::oCaseBox:SetCaption(cCaption)
    ::oCaseBox:SetSize({nCBWidth + aTextBox[3, 1], aTextBox[3, 2]})

Sorry about that!

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Osvaldo RamirezRe: XbpCheckBox:autosize
on Thu, 13 Aug 2020 17:13:34 -0600
On 13/08/20 16:37, Andreas Gehrs-Pahl wrote:
> Carlos,
> 
> Some minor corrections, to always use your variable name "::oCaseBox",
> instead of the generic "oXbp" variable that I used:
>   
> LOCAL cCaption := "Maiusculas/Minusculas", nCBWidth, aTextBox
>      ::oCaseBox := XbpCheckBox():New(::oBox, , , , aPPDialog)
>      ::oCaseBox:AutoSize     := .t.
>      ::oCaseBox:Selection    := .f.
>      ::oCaseBox:PointerFocus := .f.
>      ::oCaseBox:TabStop      := .t.
>      ::oCaseBox:Create()
>      nCBWidth := ::oCaseBox:CurrentSize()[1]
>      aTextBox := GraQueryTextBox(::oCaseBox:LockPS(), cCaption)
>      ::oCaseBox:UnLockPS()
>      ::oCaseBox:SetCaption(cCaption)
>      ::oCaseBox:SetSize({nCBWidth + aTextBox[3, 1], aTextBox[3, 2]})
> 
> Sorry about that!
> 
> Andreas
> 
Thanks a lot

Regards
Osvaldo Ramirez
Carlos A Beling Re: XbpCheckBox:autosize
on Fri, 14 Aug 2020 18:13:05 -0300
Hi Andreas:
good night.
Many thanks again.

Fraternally
Beling


On 13/08/2020 19:37, Andreas Gehrs-Pahl wrote:
> Carlos,
> 
> Some minor corrections, to always use your variable name "::oCaseBox",
> instead of the generic "oXbp" variable that I used:
>   
> LOCAL cCaption := "Maiusculas/Minusculas", nCBWidth, aTextBox
>      ::oCaseBox := XbpCheckBox():New(::oBox, , , , aPPDialog)
>      ::oCaseBox:AutoSize     := .t.
>      ::oCaseBox:Selection    := .f.
>      ::oCaseBox:PointerFocus := .f.
>      ::oCaseBox:TabStop      := .t.
>      ::oCaseBox:Create()
>      nCBWidth := ::oCaseBox:CurrentSize()[1]
>      aTextBox := GraQueryTextBox(::oCaseBox:LockPS(), cCaption)
>      ::oCaseBox:UnLockPS()
>      ::oCaseBox:SetCaption(cCaption)
>      ::oCaseBox:SetSize({nCBWidth + aTextBox[3, 1], aTextBox[3, 2]})
> 
> Sorry about that!
Really it is not your fault.
> 
> Andreas
>