Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 15 total
Thread TEdit's MaxLength Not Respected
Tue, Jul 24 2018 4:33 AMPermanent Link

Frederick Chin

If I set a TEdit's MaxLength Property to say, 5, EWB does not limit the characters entered to 5. The property seems to be ignored.

--
Frederick
Tue, Jul 24 2018 12:56 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< If I set a TEdit's MaxLength Property to say, 5, EWB does not limit the characters entered to 5. The property seems to be ignored. >>

Which browser are you using ?  I just tried it here, and it seems to work fine with the default browser for the IDE (IE) and Chrome.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jul 24 2018 6:17 PMPermanent Link

Frederick Chin

Tim,

/*
Which browser are you using ?  I just tried it here, and it seems to work fine with the default browser for the IDE (IE) and Chrome.
*/

I use Opera. The problem happens when the object is bound to a field in a DBISAM table and it also affects Chrome and the internal browser.

--
Frederick
Fri, Jul 27 2018 4:03 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< I use Opera. The problem happens when the object is bound to a field in a DBISAM table and it also affects Chrome and the internal browser. >>

Can you send me an example project that demonstrates what you're seeing ?

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Jul 28 2018 6:46 PMPermanent Link

Frederick Chin

Tim,

/*
Can you send me an example project that demonstrates what you're seeing ?
*/

Please find attached.

I have also included a video of the running project in EWB's internal browser.

--
Frederick



Attachments: testedit.zip
Tue, Jul 31 2018 3:20 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< Please find attached. >>

Yeah, the max length for data-bound edits is reset to match the length of the data column when the data column is bound to the control, hence the behavior.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Aug 1 2018 12:31 AMPermanent Link

Frederick Chin

Tim,

/*
Yeah, the max length for data-bound edits is reset to match the length of the data column when the data column is bound to the control, hence the behavior.
*/

I suppose this will change in a future update of EWB? Delphi exhibits the correct behaviour by following what has been set in MaxLength.

Currently, I put code in the OnChange event of the TEdit to truncate the excess length and that is just weird.

--
Frederick
Wed, Aug 1 2018 6:29 AMPermanent Link

Walter Matte

Tactical Business Corporation

What data type are you trying to set Max Length on.

If it is a String and the database definition is 15 characters then EWB should sets it to 15 - this makes perfect sense.

If you want to fool the system - set the data definition of the field via the property manager or in code, to a longer length and truncate as you are doing.  

Walter
Wed, Aug 1 2018 10:27 AMPermanent Link

Frederick Chin

Walter Matte wrote:

/*
What data type are you trying to set Max Length on.

If it is a String and the database definition is 15 characters then EWB should sets it to 15 - this makes perfect sense.

If you want to fool the system - set the data definition of the field via the property manager or in code, to a longer length and truncate as you are doing.  
*/

The TEdit is for a string. I believe that EWB should be able to restrict the number of characters based on the setting of MaxLength regardless whether the field is data bound or not. This is how Delphi works and this should be the way.

Since EWB is meant to be used in environments where the database backend is of no concern to it, it should be able to handle the front end control. I know of some developers in MSSQL who set their string fields as varchar(255) for every table. Assuming that we are writing the front-ends for their databases and we cannot change their structures, it makes better sense that we can control what can be entered for the string fields.

A simple property change is better than fooling around with the data definition.

--
Frederick
Wed, Aug 1 2018 11:25 AMPermanent Link

Raul

Team Elevate Team Elevate

On 8/1/2018 10:27 AM, Frederick Chin wrote:

> The TEdit is for a string. I believe that EWB should be able to restrict the number of characters based on the setting of MaxLength regardless whether the field is data bound or not. This is how Delphi works and this should be the way.

So if one were to modify the record and write it back to database would
you be OK if it's now truncated to control max length ?

Raul
Page 1 of 2Next Page »
Jump to Page:  1 2
Image