Page 3 of 5
					
				
				Posted: Tue May 20, 2008 4:38 pm
				by ricardo
				If someone uses the #ACO_SEARCH, how to know if user pick up this option?
As far as i can see it uses the word "Search " in the language of the user, so by this way is hard to find it.
I guess there is some correct way to find it out.
Thanks in advance
			 
			
					
				
				Posted: Fri May 30, 2008 9:24 am
				by leodh
				Hi,
I have been playing aound with the autocomplete gadget and it is proving to be very handy.
I would like to know how to find out which element of the Srting$ array has been selected, as I would like to populate some other gadgets with text from an array depending on what is selected with the autocomplete.
At the moment I am using a comboboxgadget and it works but it is not as nice as the autocomplete.
Code: Select all
Case #String_6
               If GetGadgetText(#String_6)>""
                  Result = GetGadgetState(#String_6)
                  result= result+1 
                  SetGadgetText(#String_7,Supplier.s(Result,2))
                  SetGadgetText(#String_8,Supplier.s(Result,3)+" "+Supplier.s(Result,4)+" "+Supplier.s(Result,5))
                  SetGadgetText(#String_9,Supplier.s(Result,12))
                  SetGadgetText(#String_10,Supplier.s(Result,13))
                  SetGadgetText(#String_11,Supplier.s(Result,10))
                EndIf
Is there a way to find out which element was selected in the autocomplete gadget.
Thanx Leo
 
			 
			
					
				
				Posted: Sat Aug 09, 2008 9:36 am
				by Arcee_uk
				Hi.
I have just found this code and while I have no idea what all the additional bits do since the first set of code (which works perfectly for me), I have a question.
Is  there a way for a user to see ALL the possible options in the autocomplete list. So if you hit the down arrow you see all options in the list rather than having to press a key to see all entiries starting with that letter/number?
This would make this perfect for what I need to do if that was possible.
Thanks
Aree.
			 
			
					
				
				Posted: Sat Aug 09, 2008 1:06 pm
				by Arcee_uk
				leodh wrote:Hi,
I have been playing aound with the autocomplete gadget and it is proving to be very handy.
I would like to know how to find out which element of the Srting$ array has been selected, as I would like to populate some other gadgets with text from an array depending on what is selected with the autocomplete.
At the moment I am using a comboboxgadget and it works but it is not as nice as the autocomplete.
Code: Select all
Case #String_6
               If GetGadgetText(#String_6)>""
                  Result = GetGadgetState(#String_6)
                  result= result+1 
                  SetGadgetText(#String_7,Supplier.s(Result,2))
                  SetGadgetText(#String_8,Supplier.s(Result,3)+" "+Supplier.s(Result,4)+" "+Supplier.s(Result,5))
                  SetGadgetText(#String_9,Supplier.s(Result,12))
                  SetGadgetText(#String_10,Supplier.s(Result,13))
                  SetGadgetText(#String_11,Supplier.s(Result,10))
                EndIf
Is there a way to find out which element was selected in the autocomplete gadget.
Thanx Leo
 
I wondered this as I need to know this as well.
I came up with this basic (and probably overly complicated way):
Code: Select all
Result$=GetGadgetText(#String_0)
For C=0 To PeekL(Strings() - 8)-1
If Strings(C)=Result$
Element=C
Debug Str(C)+" : "+GetGadgetText(#String_0)
EndIf
Next C
Works prefectly in my tests and is quick as well.
I hope this what you wanted.
Arcee
 
			 
			
					
				
				Posted: Fri Sep 05, 2008 5:00 pm
				by Karbon
				Ran into another problem somewhat like the one I had last summer. Different combo box, different error..
I get "Invalid memory access. (read error at address 0)
On the ProcedureReturn here : 
Code: Select all
If count = celt
    ProcedureReturn #S_OK ;; error here
  Else
    ProcedureReturn #S_FALSE
  EndIf
I open the window with the autocomplete'd gadget on it, type a letter, everything works fine. Close the window. Re-open it, type a character in the autocompleted combo and the crash happens every time.
PB 4.20, threadsafe on Windows XP SP3
The full offending procedure : 
Code: Select all
Procedure IEnumString_Next(*THIS.EnumString, celt, *rgelt.Long, *pceltFetched.Long)
  If *THIS\Enumerator + celt <= *THIS\StringCount
    count = celt
  Else
    count = *THIS\StringCount - *THIS\Enumerator
  EndIf
  
  For i = 0 To count-1
    *rgelt\l = *THIS\Buffer\Strings[*THIS\Enumerator + i]
    *rgelt + 4
  Next i
  
  *THIS\Enumerator + count
  
  If *pceltFetcted
    *pceltFetched\l = count
  EndIf
  
  If count = celt
    ProcedureReturn #S_OK ;; error here
  Else
    ProcedureReturn #S_FALSE
  EndIf
EndProcedure
 
I've used the heap validation routine that freak posted and it doesn't seem to be the same thing that happened before-  the ValidatePBHeap() procedure returns all is well.
 
			 
			
					
				
				Posted: Mon Sep 08, 2008 7:37 pm
				by Karbon
				Does anyone have any ideas on this one? I'm drawing a blank.
			 
			
					
				
				Posted: Mon Sep 08, 2008 8:26 pm
				by freak
				I ran into the same problem a while ago. But i have no solution so far either.
It appears to be crashing in the AutoComplete object's code itself, after my code correctly returned the first string. I have no idea why.
			 
			
					
				
				Posted: Mon Sep 08, 2008 8:31 pm
				by Karbon
				Thanks!
Do you know of any other way to create the end result (an auto completing, editable combo box)?
			 
			
					
				
				Posted: Mon Sep 08, 2008 9:01 pm
				by Karbon
				I found another problem last night as well. Copy/paste something into a combo with this autocomplete code in any version of Vista and it crashes pretty violently 

 
			 
			
					
				
				Posted: Mon Sep 08, 2008 9:19 pm
				by freak
				The only other way is to code it all manually afaik.
			 
			
					
				
				Posted: Mon Oct 20, 2008 8:01 pm
				by Marco2007
				I`m a little confused: I always get an IMA at the last line when using Freak`s Code from the first post (exact the same). 
The strange thing: I`m using Freak`s Code in an application without any problems. Never had problems until today....
Does anyone know, what could be? Because I want to implement that again....
			 
			
					
				
				Posted: Mon Oct 20, 2008 8:04 pm
				by Karbon
				IMA?
			 
			
					
				
				Posted: Mon Oct 20, 2008 8:13 pm
				by Marco2007
				Yes, IMA (read error at address 197....). 
I just run the first code. Press 'e' -> select a word -> Close the window -> IMA. 
Never happened before....Could you try it, please? 
I can`t believe it...
			 
			
					
				
				Posted: Mon Oct 20, 2008 8:22 pm
				by Marco2007
				I just found out, when closing the window with CloseWindow(), it works (no IMA).  
Code: Select all
      Repeat 
        event=WaitWindowEvent()
        Select event
          Case #PB_Event_CloseWindow
            If EventWindow()=#window_0
            CloseWindow(#window_0)
            quit=1
            EndIf
        EndSelect
      Until quit = 1
  
It also doesn`t crash, when doing this:
Code: Select all
      Repeat 
        event=WaitWindowEvent()
      Until event = #PB_Event_CloseWindow
      CloseWindow(#window_0)
  
 
			 
			
					
				
				Posted: Mon Oct 20, 2008 8:39 pm
				by ts-soft
				@Marco2007
I think you or the code uses a callback without testing of existing the control.
CloseWindow is the simple way to solve this  
