Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10211 > unrolled thread

MultiLineEdit inherit from RichEdit - no text limit working

Started by"Jose F Zouain" <jfzouain@zetaconcepts.com>
First post2017-02-24 00:58 +0000
Last post2017-03-01 04:48 -0800
Articles 8 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  MultiLineEdit inherit from RichEdit - no text limit working "Jose F Zouain" <jfzouain@zetaconcepts.com> - 2017-02-24 00:58 +0000
    Re: MultiLineEdit inherit from RichEdit - no text limit working "Jamal" <noooospam@example.com> - 2017-02-23 23:04 -0500
    Re: MultiLineEdit inherit from RichEdit - no text limit working D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-02-24 14:03 +0100
      Re: MultiLineEdit inherit from RichEdit - no text limit working "Jose F Zouain" <jfzouain@zetaconcepts.com> - 2017-02-24 19:26 +0000
        Re: MultiLineEdit inherit from RichEdit - no text limit working "Jose F Zouain" <jfzouain@zetaconcepts.com> - 2017-02-27 15:20 +0000
    Re: MultiLineEdit inherit from RichEdit - no text limit working Sherlock <sherlock@sherlock.com.au> - 2017-02-27 08:55 -0800
      Re: MultiLineEdit inherit from RichEdit - no text limit working "Jose F Zouain" <jfzouain@zetaconcepts.com> - 2017-02-28 18:31 +0000
    Re: MultiLineEdit inherit from RichEdit - no text limit working Sherlock <sherlock@sherlock.com.au> - 2017-03-01 04:48 -0800

#10211 — MultiLineEdit inherit from RichEdit - no text limit working

From"Jose F Zouain" <jfzouain@zetaconcepts.com>
Date2017-02-24 00:58 +0000
SubjectMultiLineEdit inherit from RichEdit - no text limit working
Message-ID<eh9epcFl2d6U1@mid.individual.net>
Hi All

I have a Dialog Window that has a MultiLineEdit control that inherit
from RichEdit.

All is working OK, except I cannot limit the characters in the MLE.

By default RichEdit has 30 K characters, but I want to limit it to 240
Char.

Have done all I can possibly do, but it keeps adding beyond the 240
char.

Here is is the code for the Change edit, with all my tries, need a
helping hand. Thanks in advance

Jose

METHOD EditChange(oControlEvent) CLASS FAPeriodFormWA
	LOCAL oControl 		AS Control

	oControl := IIF(oControlEvent == NULL_OBJECT, NULL_OBJECT,
oControlEvent:Control)
	SUPER:EditChange(oControlEvent)

	IF oControl:NameSym == #ACCDNOTA
		//Set field lenght limit
		//SELF:oDCACCDNOTA:TextLimit := SELF:oDCACCDNOTA:FieldSpec:length
		SELF:oDCACCDNOTA:TextLimit := 240
		 
		 //SELF:oDCACCDNOTA:FieldSpec:length:SetRange(0, 240, )
       //SELF:oDCACCDNOTA:FieldSpec:SetRange(0,240)

		//Display KeyCount in screen
		//SELF:oDCSLEKeyCount:TextValue :=
NTrim(SLen(AllTrim(SELF:oDCACCDNOTA:CurrentText)))  + "/" +
NTrim(SELF:oDCACCDNOTA:TextLimit)
		SELF:oDCSLEKeyCount:TextValue :=
NTrim(SLen(AllTrim(SELF:oDCACCDNOTA:CurrentText)))  + "/240"
	ENDIF	 

[toc] | [next] | [standalone]


#10212

From"Jamal" <noooospam@example.com>
Date2017-02-23 23:04 -0500
Message-ID<o8obcq$iio$1@news.albasani.net>
In reply to#10211
RichEdit text length is not exactly what you see on screen; It has embedded 
codes which you do not see, so limiting its length does not make sense 
anyway, especially if you are saving the RTF text to a DBF field!

It is better to save it to a file.

Anyway, you asked a similar question which I answered on the proper way to 
do it in the properties window NOT the EditChange event!

https://groups.google.com/forum/#!searchin/comp.lang.clipper.visual-objects/Character$20count$20in$20a$20NNN$20(240)$20character$20field%7Csort:date/comp.lang.clipper.visual-objects/bxLqg821Fck/aWSgAxwDBAAJ

Jamal

"Jose F Zouain"  wrote in message news:eh9epcFl2d6U1@mid.individual.net...


Hi All

I have a Dialog Window that has a MultiLineEdit control that inherit
from RichEdit.

All is working OK, except I cannot limit the characters in the MLE.

By default RichEdit has 30 K characters, but I want to limit it to 240
Char.

Have done all I can possibly do, but it keeps adding beyond the 240
char.

Here is is the code for the Change edit, with all my tries, need a
helping hand. Thanks in advance

Jose

METHOD EditChange(oControlEvent) CLASS FAPeriodFormWA
LOCAL oControl AS Control

oControl := IIF(oControlEvent == NULL_OBJECT, NULL_OBJECT,
oControlEvent:Control)
SUPER:EditChange(oControlEvent)

IF oControl:NameSym == #ACCDNOTA
//Set field lenght limit
//SELF:oDCACCDNOTA:TextLimit := SELF:oDCACCDNOTA:FieldSpec:length
SELF:oDCACCDNOTA:TextLimit := 240

//SELF:oDCACCDNOTA:FieldSpec:length:SetRange(0, 240, )
       //SELF:oDCACCDNOTA:FieldSpec:SetRange(0,240)

//Display KeyCount in screen
//SELF:oDCSLEKeyCount:TextValue :=
NTrim(SLen(AllTrim(SELF:oDCACCDNOTA:CurrentText)))  + "/" +
NTrim(SELF:oDCACCDNOTA:TextLimit)
SELF:oDCSLEKeyCount:TextValue :=
NTrim(SLen(AllTrim(SELF:oDCACCDNOTA:CurrentText)))  + "/240"
ENDIF 

[toc] | [prev] | [next] | [standalone]


#10213

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2017-02-24 14:03 +0100
Message-ID<0kb0bc114etqqd27k2bf97gqsruh8h46pa@4ax.com>
In reply to#10211
Replying on message of 24 Feb 2017 00:58:21 GMT from Jose F Zouain:


 Hello Jose,

As Jamal says: use the properties window which results in Textlimit in
the init or just put SELF:oDCACCDNOTA:TextLimit := 240 in the
postinit. 

It works here; and indeed I think I remember it will be the gross
number of characters, so special characters and format codes, like /b
for bold will add to the number of characters you limit.

Dick

[toc] | [prev] | [next] | [standalone]


#10215

From"Jose F Zouain" <jfzouain@zetaconcepts.com>
Date2017-02-24 19:26 +0000
Message-ID<ehbfmdF310dU1@mid.individual.net>
In reply to#10213
Thanks Jamal and Dick.

Yes, Jamal what you sent me back on September of last year works
perfect.

But this is different I want to use the RichEdit inheritance, but the
textlimit is not working at the Property window when is at the init,
and just moved it to the Postinit from the EditChange and still doesn't
work.

One issue that I am figuring out, but I don't think it matters what
Jamal sent me I applied it to Data Window and works perfect.

But this one is a Dialog Window, which I think it doesn't matter, am I
correct.

Waiting for input.



-- 

[toc] | [prev] | [next] | [standalone]


#10223

From"Jose F Zouain" <jfzouain@zetaconcepts.com>
Date2017-02-27 15:20 +0000
Message-ID<ehiuejFhv1jU1@mid.individual.net>
In reply to#10215
Thanks all

I solve the problem, Richedit is not working as designed.

I added a limit in EditChange of 240 Char and an ALLTRIM when saving
the data. I know is not the best option but the MultiLine control is
not working with RichEdit.

Case close

-- 

[toc] | [prev] | [next] | [standalone]


#10224

FromSherlock <sherlock@sherlock.com.au>
Date2017-02-27 08:55 -0800
Message-ID<297e8cd2-6c5d-4af4-933c-c260e1a92b26@googlegroups.com>
In reply to#10211
In the POSIINIT for the window that contains he MULTILINE [ SLE or COMBOBOX edit/controsl try this..

SendMessage( SELF:oDCSLETest:HANDLE(), EM_LIMITTEXT, 30, 0 ) 
// handle to SLE or MLE, set length to 30 

SendMessage( SELF:oDCCBTest:HANDLE(), CB_LIMITTEXT, 30, 0 )
// handle to Combobox, set length to 30 

Phil McGuinness


[toc] | [prev] | [next] | [standalone]


#10226

From"Jose F Zouain" <jfzouain@zetaconcepts.com>
Date2017-02-28 18:31 +0000
Message-ID<ehltvgF613dU1@mid.individual.net>
In reply to#10224
Sherlock wrote:

> SendMessage( SELF:oDCSLETest:HANDLE(), EM_LIMITTEXT, 30, 0 ) 
> // handle to SLE or MLE, set length to 30 


Thanks Phil, works perfect now

I am taking out all the work around I did.

Jose

-- 

[toc] | [prev] | [next] | [standalone]


#10229

FromSherlock <sherlock@sherlock.com.au>
Date2017-03-01 04:48 -0800
Message-ID<98d40d0b-4122-498e-929b-9a7a4dde574f@googlegroups.com>
In reply to#10211
Jose

Good... could not let you use that other complex fix.

Phil

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web