Textarea uses the RichEdit Class, and even if is great for styled text, it has a different theme than the textfields (Edit Class) and the app looks bad with diferent borders on some of the fields.
I made a FR <https://xojo.com/issue/56415>, but in the meantime, Is there a way to have a multiline TextField control? Maybe declares or another hack
Nop, it is funny, in the ide, when turning off the styled, changes the preview of the control, but in run time, it is the same RichEdit with the same look.
Great idea, this will be my workaround for now. Instead of a rectangle, I used a canvas to draw the background acording to the state, and also the border to indicate the focus, as a last detail, make the TextArea smaller and 5px to the right. (The lack of padding also looks awfull).
Wow, just tested on mac and, yes, the “Single line” TextField in xojo are not created with the “Single line mode” so, it is posible to edit multiline text.
Looks like the TextField also needs a Multiline property on MacOS
Not here, I tested before sending the answer (else I would say nothing).
Michel: this does not work as expected: the set of properties does not change (stays the one for TextField)
I try that too.
Edit: Sorry, because of my very small boot SSD size, I removed my Windows VM, so I do not tested on Windows (and I do not realized the question was for Windows, else )
[quote=445913:@Emile Schwarz]Michel: this does not work as expected: the set of properties does not change (stays the one for TextField)
I try that too.[/quote]
I just looked at it under Windows : changing super does change the set of properties. As expected. And it is fairly easy to come up with a multiline textfield that way.
@Ivan Tellez : Drag a textfield to the window, the click on “Super” in the Inspector, and select “TextArea”. You will find the multiline property.
[quote=445970:@Michel Bujardet]I just looked at it under Windows : changing super does change the set of properties. As expected. And it is fairly easy to come up with a multiline textfield that way.
@Ivan Tellez : Drag a textfield to the window, the click on “Super” in the Inspector, and select “TextArea”. You will find the multiline property.[/quote]
As @Alberto DePoo said, that is the same as dragging a TextArea directly, that why I wrote in the first post:
[quote=445883:@Ivan Tellez]I know, “use a Textarea”, but…
[/quote]
Native EDIT control in windows (created with xojo TextField) can be Single line and multiline, but xojo only exposes the Single line option.
Changing the “Super” to “TextArea” or dragging a “TextArea” directly, creates a Native RichEdit control in windows, this also can be single line or multine and Xojo exposes both behaviors. BUT it looks like very different than the TextField, breaking the UI of the app.
It really changes the look and feel of and app having properly themed controls.
Imagine if the IDE also have good looking multiline Textfields and Properly themed TextAreas…
Until xojo fixes this, if womeone is interested on having a better look in your app:
Fixing the padding:
#If TargetWindows Then
Declare Sub GetClientRect Lib "User32" (handle As Integer, r As Ptr)
Declare Sub InflateRect Lib "User32" (r As Ptr, dx As Int32, dy As Int32)
Declare Function SendMessageA Lib "User32" (hWnd As Integer, Msg As Integer, wParam As Integer, lParam As Ptr) As Integer
Declare Function SendMessageW Lib "User32" (hWnd As Integer, Msg As Integer, wParam As Integer, lParam As Ptr) As Integer
Dim mb As New MemoryBlock (16)
GetClientRect (Me.Handle, mb)
InflateRect (mb, -6, -3)
Const EM_SETRECT = &h00B3
If System.IsFunctionAvailable ("SendMessageW", "User32") Then
Call SendMessageW (Me.Handle, EM_SETRECT, 0, mb)
Else
Call SendMessageA (Me.Handle, EM_SETRECT, 0, mb)
End If
Me.Refresh
#EndIf
-Disable the controls border.
As for the border, since it will requiere to intercept the Paint message and custom draw using the theme framewor of the OS, I just put the TextArea over a canvas that draws a rect whith color Realbasic.FrameColor or Realbasic.HiglightColor