EControl Ltd. Forum Index EControl Ltd.
VCL libraries and software support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AutoComplete Problem

 
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor
View previous topic :: View next topic  
Author Message
ulrikj



Joined: 07 Aug 2006
Posts: 12

PostPosted: Wed Aug 30, 2006 1:51 pm    Post subject: AutoComplete Problem Reply with quote

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
View user's profile Send private message
mstaszew



Joined: 21 Jul 2006
Posts: 67
Location: North Carolina, USA

PostPosted: Wed Aug 30, 2006 5:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
ulrikj



Joined: 07 Aug 2006
Posts: 12

PostPosted: Thu Aug 31, 2006 8:05 am    Post subject: Right, hm.. Reply with quote

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
View user's profile Send private message
ulrikj



Joined: 07 Aug 2006
Posts: 12

PostPosted: Thu Aug 31, 2006 8:17 am    Post subject: Further information Reply with quote

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
View user's profile Send private message
ulrikj



Joined: 07 Aug 2006
Posts: 12

PostPosted: Fri Sep 01, 2006 8:45 am    Post subject: Oops, I did it again. Reply with quote

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
View user's profile Send private message
mstaszew



Joined: 21 Jul 2006
Posts: 67
Location: North Carolina, USA

PostPosted: Fri Sep 01, 2006 1:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Sun Sep 03, 2006 8:34 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
ulrikj



Joined: 07 Aug 2006
Posts: 12

PostPosted: Thu Sep 14, 2006 8:08 am    Post subject: Sorry, Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group