B4J Question richviewfx codearea resize question

Mahimahi

Member
Licensed User
Referencing a custom view graciously created and shared by "stevel05", from https://www.b4x.com/android/forum/threads/custom-view-richviewfx-codearea.62823/

Hi, I am trying to switch from using TextArea to CodeArea to take advantage of highlighting of text. With TextArea I was able to resize when the main layout window resizes using .PrefWidth = MainLayoutForm.Width - x, and .PrefHeight = MainLayoutForm.Height - y. With CodeArea I tried doing .setup(MainLayoutForm, Null, 0, 400, MainLayoutForm.Width - x, MainLayoutForm.Height-y) which resizes the control initially when app starts, but while the window/main layout resizes, it doesn't seem to be resizing in MainLayoutForm_Resize event sub.

Can someone please give some pointers? Thanks a lot.
 

stevel05

Expert
Licensed User
Longtime User
As it is a custom view, you need to change the base pane size richtextview1.BasePane.SetSize(Widht Height), Setup should only be called once.
 
Upvote 0

Mahimahi

Member
Licensed User
Thanks for the insight stevel05, it works well. On a different note, I came across a small issue generating the _TextChanged event sub from designer and it has parameter (text as string) and when the program ran, it gave me a

"java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception: Sub codearea1_textchanged signature does not match expected signature."

In the end, I looked at your sample program and realized it should be:

"Sub CodeArea1_TextChanged(OldVal As String,NewVal As String)"

Just thought I mention as an fyi. Thanks a lot for your help.
 

Attachments

  • designer_generated_textChanged_event_parameter_issue.png
    designer_generated_textChanged_event_parameter_issue.png
    43 KB · Views: 234
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Thanks, I'll change it next time I do some work on it.
 
Upvote 0

Mahimahi

Member
Licensed User
Is it possible to display scrollbars on the codearea/richtextview? Vertical scrollbar is more what I am looking to implement in the current project. Please advise. Thanks a lot.
 
Upvote 0
Top