PlanetSquires Forums

Support Forums => PlanetSquires Software => Topic started by: SeaVipe on March 07, 2020, 05:55:28 PM

Title: Label
Post by: SeaVipe on March 07, 2020, 05:55: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.
Title: Re: Label
Post by: Paul Squires on March 07, 2020, 09:51: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?
Title: Re: Label
Post by: Pierre Bellisle on March 07, 2020, 11:12:30 PM
You might also try to increase the height. You may be a victim of a word-wrap...
Title: Re: Label
Post by: SeaVipe on March 08, 2020, 03:03:40 PM
Thanks, Paul and Pierre, Here is the code:

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.
Title: Re: Label
Post by: Paul Squires on March 08, 2020, 09:08: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.
Title: Re: Label
Post by: SeaVipe on March 09, 2020, 01:18:29 PM
👍