Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: TextBox position issue

  1. #1
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,445

    Default TextBox position issue

    I have a title TextBox, using different font sizes, bold, and trying to center it on screen.... Thought it would be easier..

    Code:
        Object oTextBox1 is a TextBox
            Set Auto_Size_State to False
            Set Size to 19 724
            Set Location to 5 4
            Set Label to "Uso da função JSON_ARRAY"
            Set Justification_Mode to JMode_Center
            Set peAnchors to anTopLeftRight
            Set TextColor to clGrayText
            Set FontPointHeight to 18
            Set FontUnderline to True
        End_Object
    On Design time inside Studio, it seems all ok... but when the program is running and the view is opened...

    Click image for larger version. 

Name:	textbox_center_position.PNG 
Views:	125 
Size:	37.3 KB 
ID:	14255

    Auto_size_state is false, becuase the size calculations are not good using this fontsize. The text get clipped if I set autosize to true.


    The label get "Fixed" if I resize the view..
    Samuel Pizarro

  2. #2
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: TextBox position issue

    Shouldn't this be in the Windows forum?

    Anyway - I wonder if the ã might be confusing it? Also - does it position correctly with the last three set lines commented out? Auto_Size_State does have to be false for any text that has effects. Maybe try setting it to "Anchor_None" & see?
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  3. #3
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,445

    Default Re: TextBox position issue

    Wrong forum. Sorry. Please DAW, move it.
    Samuel Pizarro

  4. #4
    Join Date
    Feb 2009
    Location
    Stuart, FL
    Posts
    5,321

    Default Re: TextBox position issue

    try setting the font first
    Michael Salzlechner
    StarZen Technologies, Inc
    http.://www.starzen.com

    IT Director at Balloons Everywhere

    Development Blog
    http://www.salzlechner.com/dev

    DataFlex Package Manager (aka Nuget for DataFlex)
    http://windowsdeveloper.com/dfPackage

  5. #5
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,445

    Default Re: TextBox position issue

    Yeah... remember some discussion about this in the past...

    this ordering solve it..

    Code:
            Set Label to "Uso da função JSON_QUERY"
            Set FontPointHeight to 18
            Set FontUnderline to True
            Set TextColor to clGrayText
            Set peAnchors to anTopLeftRight
            Set Justification_Mode to JMode_Center
    Samuel Pizarro

  6. #6
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,445

    Default Re: TextBox position issue

    Thanks Garret...

    it was the ordering of the Set properties ...

    I remember vaguely this issue being discussed... guess this issue is around for a long time.. One of those things that never reach the required importance to get fixed..
    Samuel Pizarro

  7. #7
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: TextBox position issue

    Yet another things that makes DF look bad to newbies*. Glad Michael pointed you in the right direction!

    I really liked how 18.2 (I think it was 18.2) addressed a lot of "little" issues. I'd love to see a 2021.5 that did the same - especially with so much pkg code cleaned up already.
    Last edited by Garret Mott; 24-Jan-2021 at 03:40 PM.
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  8. #8
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,445

    Default Re: TextBox position issue

    Ok. TextBox madness again

    Sorry to revive this... but this is striking me again, in the same project.. in a new view..

    I am using exactly the same settings values, and setting the properties in exactly the same order, but the textbox in the second view is MAD!

    Click image for larger version. 

Name:	TextBox_madness_again.jpg 
Views:	56 
Size:	93.7 KB 
ID:	14550

    Code for the right-side textbox (the one that works..)
    Code:
        Object oTextBox1 is a TextBox
            Set Auto_Size_State to False
            Set Size to 19 724
            Set Location to 5 4
            Set FontPointHeight to 18
            Set FontUnderline to True
            Set TextColor to clGrayText
            Set peAnchors to anTopLeftRight
            Set Justification_Mode to JMode_Center
            Set Label to "Uso da função JSON_QUERY"
        End_Object
    code for the 2nd new view (left-side) the one that does not center properly.
    Code:
        Object oTextBox1 is a TextBox
            Set Auto_Size_State to False
            Set Size to 19 787
            Set Location to 5 4
            Set FontPointHeight to 18
            Set FontUnderline to True
            Set TextColor to clGrayText
            Set peAnchors to anTopLeftRight
            Set Justification_Mode to JMode_Center
            Set Label to "Uso da função JSON_TABLE"
        End_Object
    I tried several combinations of ordering to set the properties.. No luck with this one. I guess I am hitting some edge-case in the internal calculations.

    This is getting so frustrating. too much time spending in something that should be easy to achieve. :-(
    Samuel Pizarro

  9. #9
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: TextBox position issue

    I just threw your code on a view (making the textboxes smaller so they'd fit (724 & 787 makes for a BIG view!).

    However - having both anTopLeftRight made them partially display. I changed them to anTopLeft & anTopRight & they displayed fine.

    ETA: The sizing is messed up. Even with anTopLeft & anTopRight - making the view narrower overwrites the left textbox way sooner than it should.
    Last edited by Garret Mott; 24-Apr-2021 at 10:32 AM.
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  10. #10
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: TextBox position issue

    Really strange. I threw a border on both so I could see the size.

    Studio:

    Attachment 14551

    Running:

    Attachment 14552

    Code:
    Use Windows.pkg
    Use DFClient.pkg
    
    Deferred_View Activate_otesttext for ;
    Object otesttext is a dbView
    
        Set Border_Style to Border_Thick
        Set Size to 63 643
        Set Location to 2 2
        Set Label to "testtext"
    
        Object oTextBox1 is a TextBox
            Set Auto_Size_State to False
            Set Size to 19 213
            Set Location to 5 4
            Set FontPointHeight to 18
            Set FontUnderline to True
            Set TextColor to clGrayText
            Set peAnchors to anTopLeft
            Set Justification_Mode to JMode_Center
            Set Label to "Uso da função JSON_QUERY"
            Set Border_Style to Border_Normal
        End_Object
        
        Object oTextBox2 is a TextBox
            Set Auto_Size_State to False
            Set Size to 19 214
            Set Location to 4 351
            Set FontPointHeight to 18
            Set FontUnderline to True
            Set TextColor to clGrayText
            Set peAnchors to anTopRight
            Set Justification_Mode to JMode_Center
            Set Label to "Uso da função JSON_TABLE"
            Set Border_Style to Border_Normal
        End_Object
    
        Object oForm1 is a Form
            Set Size to 13 100
            Set Location to 41 257
            Set Label_Col_Offset to 2
            Set Label_Justification_Mode to jMode_Right
        End_Object
    Cd_End_Object
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •