OnInputChange - useless???

Good morning everyone [;)] Our users suggested that when, upon entering text into field “Description”, they reach the maximum length of this field, the input cursor should automagically jump into field “Description 2”. The OnInputChange trigger of “Description” seemed well suited for this task - but there seems to be no way (at least in NF 2.60) of determining 1) which character was entered and more important 2) the current value of “Description”. Rec and xRec do not change during user input. Besides, I am merely interested in the length of the current value, and even this is impossible. [xx(] A search in the forum archives confirmed my observation. This renders the OnInputChange trigger rather useless, doesn’t it? Has anyone found a way to find out what’s going on in the control during execution of this trigger?

Heinz, Why dont u use autoenter.

Rajesh, Thanks for the tip! I didn’t know this property. The only problem is that this is taking place in a tabular form where the user may arrange columns in whatever way she likes, and I want to move from “Description” specifically to “Description 2” - AutoEnter will make the focus move to the next control, regardless of what it happens to be.

Hi Heinz, there is also a Property called NextControl where you can put the ID of the next Control [:D]. Put in The ID of Description 2 and then it is no matter in which way the Columns are sorted. Greetings, Frank

Thanks Frank! Now everything seems to work great, except for yet another little problem (I know I’m starting to be somewhat annoying [:D]): When “Description 2” is not visible on the form because the user chose to remove it, the following happens when typing into “Description”: 1) The user enters text. 2) The text fills the entire control. 3) The user continues to type text. 4) Navision clears the control without warning etc.(!!!). 5) The new text is entered into the same control. 6) Back to step 2. In effect, the user can continuously type an endless stream of text into the same control without ever reaching an end or moving to another control and without ever noticing that the text just typed is lost and replaced by the new input… [:0] Any ideas regarding the strange OnInputChange trigger, anyone?

Hi Heinz, but before Navision cleares the control the OnAfterInput-Trigger is executed. And in this Trigger you have access to the Text the user types or has typed. There you can place your warning. Nevertheless the OnInputChange-Trigger is misterious. The OnlineHelp is useless, isn’t it? OnInputChange The C/AL code in this trigger is executed while the user makes entries into a text box. You can use this trigger to check the entries the user is making as he or she enters information. But they don’t say how you can check or access the entires. Is there anybody out there, who knows how to use this Trigger? Greetings, Frank

quote:


Originally posted by FPulsfort
but before Navision cleares the control the OnAfterInput-Trigger is executed. And in this Trigger you have access to the Text the user types or has typed. There you can place your warning.


Ok, this brings us another step into the right direction [8D] But how do you distinguish between a “regular” OnAfterInput event and one that was fired after an “overflow” in the textbox?

quote:


Originally posted by FPulsfort
Nevertheless the OnInputChange-Trigger is misterious. The OnlineHelp is useless, isn’t it?


Quite indeed. The online help for this trigger isn’t worth the bytes it is using up on the harddisk [}:)]

What about the STRLEN(Text)? In your Case: If (STRLEN(Text) = MAXSTRLEN(Description)) and (Currform.“Description 2”.visible = FALSE) THEN __MESSAGE(‘Warnung!’); The only Problem is if the User wants to type exactly 50 Letters. Then the Warning is not nessecary.

Frank, I think now it’s perfect except for the unnecessary warning [;)]

Well, almost… The VISIBLE property always evaluates to TRUE, even if the field is currently not visible on the form… yech… [;)]

Strange behaviour, very strange… I’ve tested other properties of the Textbox (Column), enabled, xpos, ypos, width, but all still the same. It doesn’t matter, if the Column is shown or not. How it is possible to check if the user has fade out a column or not? What about: If STRLEN(Text) = MAXSTRLEN(Description) THEN __Currform.“Description 2”.visible := TRUE; in the OnAfterInput-Trigger? If the User Types 50 Letters then “Description 2” will be shown. No matter if he or she wants or not. I know, its only a workaround.

Frank, I have settled for a more elaborate warning message and informed our users that “strange things can happen” when I take out this message (they want to type continuously into the second field, with just a warning tone when the field is full). I’m not sure if your suggestion would work (besides it being somewhat surprising for the user to make the field suddenly become visible [;)]) - the VISIBLE property is always TRUE, so what good would it be to set it to TRUE again[?] It seems that table forms are a class of their own - I have successfully used the VISIBLE property on card forms, where they work as expected…

Hi Heinz Sorry for jumping in [:D]. While playing with form properties http://www.navision.net/forum/topic.asp?TOPIC_ID=5918 I found the same unexpected behaviour of Visible(True) on a card form. I didn’t find an answer why yet [:(]. A mystery! Perhaps as Romein said: “The smoking man with the gun …” bye André

I’ve tested a while and found out that the visible-property has the correct value after closing and opening the form again. It seems, that Navision doesn’t update the property after changing them by clicking in the headline. Strange bug. Or a feature??? [8D]

Hi Heinz, i’ve made another workaround. What you need is to see, if the Column “Description 2” is visible or not. I’ve found out, that if the column is not visible and you say Currform.“description 2”.activate, the OnActivate-Trigger is not called. In the OnActivate-Trigger of “Description” you can jump to “Description 2”, set a Flag and jumb straight back. If the column is not visible, the Flag is not set and you know in the OnAfterInput-Trigger of “Description” whether “Description 2” is visible or not. I’ve tested it and it seems to work. Be Carefull, you easily can develope an endless-loop by jumping between these two fields [:D]. To avoid this, you have to set more than one flag. But…nevertheless…its just a workaround… If you need more deatils, feel free to ask. Greetings, Frank

Frank, it seems that the visible property is set only upon instantiating the form. Not very elegant, to put it politely [;)] Anyways, our users told me that “Description 2” is usually always visible, as they need it for their daily work. I will therefore leave my solution as is and not take the risk of sending the program into an endless void of eternal jumps [;)] Thanks a lot to all who contributed!