View previous topic :: View next topic |
Author |
Message |
ulrikj
Joined: 07 Aug 2006 Posts: 12
|
Posted: Wed Aug 30, 2006 1:51 pm Post subject: AutoComplete Problem |
|
|
Hi,
Let's say I write "Obj" in the editor and press Ctrl-Space in order to invoke the autocompletion popup, and I then navigate through the possibilties, type some more, and finally backspace the entire StartString ("Obj", "Ob", "O", "") when I reach the emtpy string I receive an exception:
"Project MyDemoExe.exe raised exception class EConvertError with message ''howArray' is not a valid integer value'."
Is this a known bug, or is it more likely that I'm doing something wrong? I populate DisplayItems and Items on the OnGetAutoCompleteList event.
Best regards, |
|
Back to top |
|
|
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Wed Aug 30, 2006 5:04 pm Post subject: |
|
|
GetAutoCompleteList(Sender: TObject; Pos: TPoint; List, Display: TStrings)
Try populating List and Display instead of DisplayItems in this handler.
I use AutoCompletePopup.Items and AutoCompletePopup.DisplayItems if I want to populate the AutoCompletePopup outside of the get items handler. |
|
Back to top |
|
|
ulrikj
Joined: 07 Aug 2006 Posts: 12
|
Posted: Thu Aug 31, 2006 8:05 am Post subject: Right, hm.. |
|
|
Thanks for the advice, it will definitely be of use to me. But it doesn't change this exact situation unfortunately. Some factors I've noticed include:
- This doesn't happen until I populate the list with a big amount of data.
- I just have to press Ctrl-Space with no text to complete from in order to provoke it, there's no need to delete already written text.
I'm going to try moving some code around, so I populate DisplayItems and Items when I have the chance, and only populate the rest of the list using the handler for the code that is *currently* being changed (i.e. I'm currently populating the lists based on the entire source-project, I'll try only doing it with the current code-buffer and then populating the rest of the data only when it changes). |
|
Back to top |
|
|
ulrikj
Joined: 07 Aug 2006 Posts: 12
|
Posted: Thu Aug 31, 2006 8:17 am Post subject: Further information |
|
|
Having tried to implement what I mentioned above, I've concluded that it doesn't relate to that unfortunately. It seems simply to be related to a case where the completionstring is "" and the number of items is large. I'm currently adding 1694 items. I can delay loading most of these, so when I'm testing prior to adding them, it works just perfectly. When they've been added however, the first occurance of a attempting to complete an empty string causes the aforementioned problem with "howArray". Only 2 of the 1692 completions are added in the handler. |
|
Back to top |
|
|
ulrikj
Joined: 07 Aug 2006 Posts: 12
|
Posted: Fri Sep 01, 2006 8:45 am Post subject: Oops, I did it again. |
|
|
Heh. I managed to fix this bug by accident!
It appears it was caused by unescaped '\'s in my display-strings, that didn't have any formatting purpose, they were just part of the names. I hadn't given that much thought, until I noticed that some display strings where very mangled. So I implemented the following function:
Code: |
{ Given a string, secure that string for being embedded into a
display-string. }
function SecureDisplayString(s: String) : String;
begin
Result := StringReplace(s, '\', '\\', [rfReplaceAll, rfIgnoreCase]);
end;
|
This took care of the problem for me, as I hope it will for others experiencing the same thing. Are there other things I should be securing against? |
|
Back to top |
|
|
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Fri Sep 01, 2006 1:18 pm Post subject: |
|
|
Thanks for posting an update as your fix triggered something in me about another problem that I was having with the popups. I'll have to give it a try. |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Sun Sep 03, 2006 8:34 am Post subject: |
|
|
Please, send me (support@econtrol.ru) Items and DisplayItems those caused the error. I shall validate autocomplete display string parser to fix this bug.
Michael. |
|
Back to top |
|
|
ulrikj
Joined: 07 Aug 2006 Posts: 12
|
Posted: Thu Sep 14, 2006 8:08 am Post subject: Sorry, |
|
|
Unfortunately my dataset has changed a lot and I'm unable to provide you with the list. However, I can tell you with certainty that the list contains \ characters, as in f.eks. "Inc\Functions.vbs", which is one of the files that caused problems. This value exists inside a \t\ column splitting (3 columns total).
Once I started escaping like above, the problem went away. However, when using "Inc\\Functions.vbs", the displayed text is actually: "IncFunctions.vbs"... |
|
Back to top |
|
|
|