[Windows] AutoComplete for StringGadgets
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.
Is there a way to find out which element was selected in the autocomplete gadget.
Thanx Leo
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
Thanx Leo
Regards
Leo
Leo
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.
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.
I wondered this as I need to know this as well.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.
Is there a way to find out which element was selected in the autocomplete gadget.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
Thanx Leo
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
I hope this what you wanted.
Arcee
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 :
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 :
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.
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
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.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Does anyone have any ideas on this one? I'm drawing a blank.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Thanks!
Do you know of any other way to create the end result (an auto completing, editable combo box)?
Do you know of any other way to create the end result (an auto completing, editable combo box)?
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
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
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
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....
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....
PureBasic for Windows
IMA?
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
I just found out, when closing the window with CloseWindow(), it works (no IMA).
It also doesn`t crash, when doing this:
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)
PureBasic for Windows
@Marco2007
I think you or the code uses a callback without testing of existing the control.
CloseWindow is the simple way to solve this
I think you or the code uses a callback without testing of existing the control.
CloseWindow is the simple way to solve this
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.