[WD19] Selecting all text with ..Cursor and ..CursorEnd.

Startbeitrag von Curtis am 13.04.2015 16:59

I have a procedure that handles an error when necessary. It runs the trtEnter process of a comboBox. The code runs and I attempt to select all using this code:


SetFocus(MySelf)
LOOP_TransportationParameters.EDT_DestinationAddress..Cursor = 1
LOOP_TransportationParameters.EDT_DestinationAddress..CursorEnd = Length(EDT_DestinationAddress) + 1
RETURN


However it doesn't work although it works fine on other forms. I can even add the above code to a test button, and it will work to select all. Is this a bug? Does it have something to do with being inside a looper? SetFocus works regardless, but ..Cursor and ..CursorEnd only work on the test button.

Antworten:

Hi Curtis,

I think you must address the line number, like LOOP_TransportationParameters[__line_number__].EDT_DestinationAddress

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 13.04.2015 17:36
Unfortunately that causes an error. And that code works if I just place it on a text button.

von Curtis - am 13.04.2015 17:50
Hi Curtis,

the principle of loopers is to ALWAYS use attributes and NEVER address directly the controls.

So your code
LOOP_TransportationParameters.EDT_DestinationAddress..CursorEnd
should NOT work...

Normally, you would have to create two attributes, one for the cursor property and the other for the cursorend property, IF these are available in a looper (I've never checked)

If not, you can try creating an attribute on the EDT_De... field itself and see if ..CurosrEnd is available on it, but I doubt it.

Best regards

von Fabrice Harari - am 13.04.2015 18:22
Hi Curtis,

What is your error message? Also I'm not sure SetFocus would work in that case. Also, you for Length() you must use the ..Value property in that case or use the corresponding attribute.

This is an official way to access controls in a looper to interact with them and their properties. See this page: http://doc.windev.com/en-US/?1013284

It depends what you want to do. In some cases you must use attributes, in other cases you can use direct access (usually for properties).

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 13.04.2015 19:02
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.