PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Label  (Read 261 times)

SeaVipe

  • Senior Member
  • ***
  • Posts: 355
  • Windows 10
Label
« on: March 07, 2020, 05:25:28 PM »

Hi Paul, is there a limit to the number of characters that can be displayed in a label control? To clarify, I appear to have hit a limit of approximately 300 characters.
Logged
Clive Richey
*“You Either Have To Be Part Of The Solution, Or You’re Going To Be Part The Problem.” Eldridge Cleaver.
#StaySafe, Always  Keep A Safe #SocialDistance, #WashYourHands Often and please, #StayHome!

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9202
  • Windows 10
    • PlanetSquires Software
Re: Label
« Reply #1 on: March 07, 2020, 09:21:34 PM »

Hi Clive, I don't see anything in the code that would limit a Label to the amount of characters that you are seeing. I use CWSTR to hold the text data and that is a dynamic unicode string type. Maybe the display area of your label is not large enough and the text is getting clipped?
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Pierre Bellisle

  • Junior Member
  • **
  • Posts: 102
Re: Label
« Reply #2 on: March 07, 2020, 10:42:30 PM »

You might also try to increase the height. You may be a victim of a word-wrap...
Logged

SeaVipe

  • Senior Member
  • ***
  • Posts: 355
  • Windows 10
Re: Label
« Reply #3 on: March 08, 2020, 02:33:40 PM »

Thanks, Paul and Pierre, Here is the code:
Code: [Select]
Sub Show_Help()
    'Dim s as String * 500 = " Priority:" + Chr(13,10)
    'Dim s as String = " Priority:" + Chr(13,10)
    'Dim s as WString * 500 = " Priority:" + Chr(13,10)
    Dim s as CWSTR = " Priority:" + Chr(13,10)
    s += Chr(13,10)
    s += " A - Imminent Tasks. Must be completed by Due Date." + Chr(13,10)
    s += " B - Tasks that are weather dependent." + Chr(13,10)
    s += " C - Tasks that must be done but with a changeable Due Date." + Chr(13,10)
    s += " D - Tasks with long-term but still limited time constraints." + Chr(13,10)
    s += " E - Tasks that have no time constraints." + Chr(13,10)
    s += " F - Finished. Completed Tasks."
    frmMain.Label1.Text = s

    Dim as String x = Trim(frmMain.Label1.Text)
    ? Len(Trim(s)), Len(Trim(x))    End Sub
'' ______________________________________________________________________________________
''
Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
    Show_Help()
    Function = 0
End Function
The attached image is the result after Button1.Click. (The console displays the numbers 305 and 305) As you can see, 1/2 of line 'E' and all of line 'F' are missing. This is a new 2.0.7 project with just a Label and a Button.
« Last Edit: March 08, 2020, 02:36:10 PM by SeaVipe »
Logged
Clive Richey
*“You Either Have To Be Part Of The Solution, Or You’re Going To Be Part The Problem.” Eldridge Cleaver.
#StaySafe, Always  Keep A Safe #SocialDistance, #WashYourHands Often and please, #StayHome!

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9202
  • Windows 10
    • PlanetSquires Software
Re: Label
« Reply #4 on: March 08, 2020, 08:38:36 PM »

Sorry Clive - this is my oversight. The Label is Owner Draw. Prior to outputting the text to the drawing rectangle I was assigning it to a WSTRING * MAX_PATH variable. Obviously using MAX_PATH is not large enough and you see that in your example. I have changed the code to the following and it is now working perfectly.

                     dim as CWSTR wszCaption = AfxGetWindowText( lpdis->hwndItem )
                     DrawText( memDC, wszCaption.sptr, -1, Cast(lpRect, @rcText), lFormat )

I hope to upload a new package tomorrow. I have some help files to write and finish a visual designer sample project.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

  • Senior Member
  • ***
  • Posts: 355
  • Windows 10
Re: Label
« Reply #5 on: March 09, 2020, 12:48:29 PM »

👍
Logged
Clive Richey
*“You Either Have To Be Part Of The Solution, Or You’re Going To Be Part The Problem.” Eldridge Cleaver.
#StaySafe, Always  Keep A Safe #SocialDistance, #WashYourHands Often and please, #StayHome!