Normal Topic Conditional Opening of Field Editor (Read 2147 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Conditional Opening of Field Editor
Mar 16th, 2005 at 6:42pm
Print Post Print Post  
How can I use @FEDIT so that the field editor will open up in update mode when text entered in the box exeeds the display of it in the text box element and it opens up automatically when in add mode when added text exeeds the size of the text box?  In other word how can I measure the actual size of the text box element as compared to the @len (text element), so I can have code using @fedit on element entry event?
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Conditional Opening of Field Editor
Reply #1 - Mar 16th, 2005 at 7:12pm
Print Post Print Post  
Hello Bharat,

Your elements would need to use a fixed width font. That way a "W" is the same width as a "i". Then find out how many characters it takes to fill your element. Divide the width of your element by the number of characters. Remember the number that you get.

In your programming use @Len(ThisElement) multiply it by the number you found earlier and check it against @Width(ThisElement). If it is greater than open the editor.

This will work fine for the On Element Entry event, but if you put it in the On Element Immediate Change event you are going to have some problems. When the Editor opens the cursor is at the beginning of the editor.

So If you go to type in "This is a Test" and the editor opens after the first T in Test, you are going to end up with "estThis is a T", unless you stop once it opens, hit the end key and continue typing.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Conditional Opening of Field Editor
Reply #2 - Mar 16th, 2005 at 7:25pm
Print Post Print Post  
Bharat,
Have you considered using the SBasic commands width() and height() to dynamically grow a LE when the user enters it?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Conditional Opening of Field Editor
Reply #3 - Mar 16th, 2005 at 7:38pm
Print Post Print Post  
Mark and Ray,
Thank you for your fast response.  Fixed width fonts does not seem like good choice especially when you are working under Windows environment.  I did not explore SBasic commands width() and height() to dynamically grow a LE for this purpose. I thought that @printstring command has measure only part in there and it measures the text accurately for printing purpose so probably something in that line is available to screen and element also. In the meantime I shall look into width() and height (). Thank you.
  
Back to top
 
IP Logged