How can we get the number of lines of a text widget | developer.brewmp.com How can we get the number of lines of a text widget | developer.brewmp.com

Developer

How can we get the number of lines of a text widget

Hi

The scenario is as follows:
I am wrapping a text widget to a scroll bar and the text widget can grow upto 3 lines only i.e after 3 lines the scroll bar will be displayed.

The problem that I am facing in while deleting the characters from the text widget. When I am trying to delete the characters while at line number 1 using the clr key the scroll bar remains there even if the number of lines is less than 3.

I want to calculate the number of lines when I am deleting the characters from the text widget .

In short I want to calculate the number of lines present in the text widget!!!

Add a listener to the text widget's view model and check for the scroll events. The range given in the scroll event is the number of lines of text.
-Erik

Add a listener to the text widget's view model and check for the scroll events. The range given in the scroll event is the number of lines of text.
-Erik

Hello Erik ...
Thanks for your suggestion .But still, i am having one problem.
Problem Description :
I have added a listener to the text widget's view model . And i am getting the Event EVT_MDL_CARETLINE_CHANGE .which is working fine ,inside which i am calculating the number of lines at runtime giving me the exent of the text widget.
But when I am directly deleting the first line inside Text Widget .
I am not getting any Event where I could calculate the Number of lines (After deletion) in the Text Widget. From which i should be able to calculate the Extent of Text Widget.
-Vivek

Hello Erik ...
Thanks for your suggestion .But still, i am having one problem.
Problem Description :
I have added a listener to the text widget's view model . And i am getting the Event EVT_MDL_CARETLINE_CHANGE .which is working fine ,inside which i am calculating the number of lines at runtime giving me the exent of the text widget.
But when I am directly deleting the first line inside Text Widget .
I am not getting any Event where I could calculate the Number of lines (After deletion) in the Text Widget. From which i should be able to calculate the Extent of Text Widget.
-Vivek

EVT_MDL_CARETLINE_CHANGE is only sent then the caret moves from one line to another. This doesn't always happen when the text widget changes size. Use EVT_MDL_SCROLL_CHANGE instead.
-Erik

EVT_MDL_CARETLINE_CHANGE is only sent then the caret moves from one line to another. This doesn't always happen when the text widget changes size. Use EVT_MDL_SCROLL_CHANGE instead.
-Erik