Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Editbox with preselected text
Message
 
 
À
13/08/2001 18:16:37
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00543191
Message ID:
00543312
Vues:
16
Dragan,

Something else is going on on your form and you have to find out, what's wrong. I've just created a test form with editbox, I put this.SelStart=80, this.SelLength=10 in EditBox.GotFocus and it worked just fine.

May be, you can show us some code, so we can try to see the problem.
Also check event sequence on this form, perhaps you change it somehow...


>>>I'm writing a wrapper around some code snippets which are held in memo fields, and exported and compiled on as-needed basis. There's an editor screen which has all it takes, and it all works except one thing: the 'Compile' button checks for the existence of the .err file, reads the file, looks for the number of the line with the error, calculates its position in the .prg, and then opens a small modal form with just an editbox, Ok and Cancel button.
>>>
>>>The part which doesn't work is trying to have the line with the error highlighted as the Modify Command or method editing window does. Checking in the debugger, the SelStart and SelLength properties are set right, and the text is highlighted properly, but when the editbox actually gets the focus, the line is not highlighted anymore, and the cursor is just before the first character.
>>>
>>
>>Where do you set those properties? Does this EditBox class have code in GotFocus(), When() methods?
>
>I tried putting the code into .gotfocus, form's .show and the method which calls the .show (the form is modal and permanently loaded, I show it and hide when needed), with results being the same all the time: the text appears selected briefly, and the cursor lands on first character nevertheless. Presently, there's nothing in the .gotfocus, and I never even touched the .when at all. There are a few lines in .keypress to handle the ctrl+w (call the Ok.click) and escape (call cancel.click - but that's also going to be cleared out since the cancelbutton.cancel=.t.).
>
>No big deal if this doesn't work, it'll be used by programmers only. Still, I thought it would be helpful. I may just insert the error lines into the text instead, as comments. Still, this problem annoys me - what if I wrote a search engine and wanted to display the text where the string was found the same way it is done in code windows?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform