• Mofdify Input dropdownlist

    From Jack Konings@21:1/5 to All on Thu Feb 24 02:40:10 2022
    Hi,

    On a window I've got a combobox as (sorted) dropdownlist. The box is filled with items which all have the same format like "R-"+9999 (like 'R-1234'). The list is used to select more detailed data.
    Currently the user punches in "R-" followed by the number. In doing this the combobox displays the item which best fits the input.
    Since the format is always the same punching in the "R-" is inefficient. It would be more convenient if the user just has to punch in the number and the best "R-9999" match would be shown.

    I tried to get this behavior by defining a keyup event, "catch" the numbers and add "R-' to them. This didn't work well and i'm starting to doubt keyup is the right way to do this.

    Can someone give me a hint as how to make the desired behavior?
    TIA.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JohnMartens@21:1/5 to All on Thu Feb 24 15:54:00 2022
    Why not use an SLE ?

    Did you check on ListBoxSelect method ?

    METHOD ListBoxSelect(oControlEvent) CLASS frmMyWindow
    SUPER:ListBoxSelect(oControlEvent)
    *
    IF oControlEvent:Control:NameSym == #MYCOMBO


    John


    Op 24-2-2022 om 11:40 schreef Jack Konings:
    Hi,

    On a window I've got a combobox as (sorted) dropdownlist. The box is filled with items which all have the same format like "R-"+9999 (like 'R-1234'). The list is used to select more detailed data.
    Currently the user punches in "R-" followed by the number. In doing this the combobox displays the item which best fits the input.
    Since the format is always the same punching in the "R-" is inefficient. It would be more convenient if the user just has to punch in the number and the best "R-9999" match would be shown.

    I tried to get this behavior by defining a keyup event, "catch" the numbers and add "R-' to them. This didn't work well and i'm starting to doubt keyup is the right way to do this.

    Can someone give me a hint as how to make the desired behavior?
    TIA.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jack Konings@21:1/5 to All on Thu Feb 24 07:03:43 2022
    The hacker solution: Push "R-" into the keyboard buffer, before entering the dialog. So you've entered it for them.

    And how would i do that?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dlzc@21:1/5 to Jack Konings on Thu Feb 24 06:49:27 2022
    Dear Jack Konings:

    On Thursday, February 24, 2022 at 3:40:13 AM UTC-7, Jack Konings wrote:
    Hi,

    On a window I've got a combobox as (sorted) dropdownlist. The box is
    filled with items which all have the same format like "R-"+9999 (like 'R-1234').
    The list is used to select more detailed data. Currently the user punches in "R-" followed by the number. In doing this the combobox displays the item which best fits the input. Since the format is always the same punching in the "R-" is inefficient.

    The hacker solution: Push "R-" into the keyboard buffer, before entering the dialog. So you've entered it for them.

    It would be more convenient if the user just has to punch in the number
    and the best "R-9999" match would be shown.

    Don't include the "R-" in the list you show them. "Doctor, it hurts when I do this!" Probably ignore "R" and "-" when they do press them, since you've trained some of them to type it. Might even say on screen "Enter the R-[number] you want more
    information on?"

    David A. Smith

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jack Konings@21:1/5 to All on Thu Feb 24 07:07:50 2022
    Why not use an SLE ?

    Because I want the user to have the possibility to select the item with mouse (and see all the items).

    Did you check on ListBoxSelect method ?

    Yes, but i fail to see how that would solve my issue.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Karl-Heinz@21:1/5 to All on Thu Feb 24 18:55:27 2022
    Hi Jack

    some month ago i posted a sleInputTimer class in the X#-Forum. With some
    small modifications the code seems to work with a DROPDOWNLIST Combo too. To see what's going on, i added some console output to the attached
    cmbTimerSearch class. Just inherit your comboBox from cmbTimerSearch and
    give it a try.

    What the CB_SELECTSTRING msg does is described here:

    https://docs.microsoft.com/en-us/windows/win32/controls/cb-selectstring

    regards
    Karl-Heinz

    CLASS cmbTimerSearch INHERIT ComboBox
    PROTECT _lTimerActive AS LOGIC
    PROTECT _nInterval := 400 AS DWORD
    PROTECT _cSearch AS STRING

    METHOD Destroy() CLASS cmbTimerSearch

    SELF:StopTimer()

    SUPER:Destroy()

    RETURN NIL

    METHOD Dispatch ( oEv ) CLASS cmbTimerSearch
    LOCAL oEvent AS Event


    oEvent := oEv


    DO CASE

    CASE oEvent:message == WM_CHAR

    _cSearch += CHR (oEvent:wParam )


    CASE oEvent:message == WM_KEYUP

    SELF:StartTimer()


    CASE oEvent:message == WM_KEYDOWN

    SELF:StopTimer()


    CASE oEvent:message == WM_KILLFOCUS

    SELF:StopTimer()


    CASE oEvent:message == WM_TIMER


    IF ! Empty ( _cSearch )

    SELF:StopTimer()

    ? "Search for:" , _cSearch := "R-" + _cSearch

    ? SendMessage( SELF:Handle() , CB_SELECTSTRING , DWORD (
    _CAST , -1 ) , LONG (_CAST, String2Psz ( _cSearch ) ) )

    _cSearch := ""

    ENDIF


    ENDCASE


    RETURN SUPER:Dispatch ( oEvent )


    METHOD init (oOwner, nID, oPoint, oDimension, kComboType, kStyle ) CLASS cmbTimerSearch

    SUPER:init (oOwner, nID, oPoint, oDimension, kComboType, kStyle )

    RETURN SELF

    METHOD SetTimerInterval ( n ) CLASS cmbTimerSearch

    _nInterval := n

    RETURN SELF

    METHOD StartTimer() CLASS cmbTimerSearch


    IF ! _lTimerActive

    IF SetTimer(SELF:Handle(), 4711 , _nInterval , NULL_PTR) == 4711

    _lTimerActive := TRUE

    ENDIF

    ENDIF

    RETURN _lTimerActive

    METHOD StopTimer() CLASS cmbTimerSearch


    IF _lTimerActive

    IF KillTimer ( SELF:Handle() , 4711 )

    _lTimerActive := FALSE

    ENDIF

    ENDIF

    RETURN ! _lTimerActive

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dlzc@21:1/5 to Jack Konings on Thu Feb 24 12:20:09 2022
    On Thursday, February 24, 2022 at 8:03:46 AM UTC-7, Jack Konings wrote:
    The hacker solution: Push "R-" into the keyboard buffer, before entering the dialog. So you've entered it for them.
    And how would i do that?

    Outside VO, but you probably have these WINAPI functions available: https://stackoverflow.com/questions/10787949/insert-into-windows-keyboard-buffer

    David A. Smith

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jack Konings@21:1/5 to All on Fri Feb 25 07:49:52 2022
    cmbTimerSearch class. Just inherit your comboBox from cmbTimerSearch and
    give it a try.

    Ah, this gives me a push in the right direction. Thanks, I will give it a try.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jack Konings@21:1/5 to All on Fri Feb 25 07:51:05 2022
    Outside VO, but you probably have these WINAPI functions available: https://stackoverflow.com/questions/10787949/insert-into-windows-keyboard-buffer

    That's a little bit over my paygrade........
    I'll give the sample of Karl-Heinz a go.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dlzc@21:1/5 to Jack Konings on Fri Feb 25 10:33:24 2022
    Dear Jack Konings:

    On Friday, February 25, 2022 at 8:51:06 AM UTC-7, Jack Konings wrote:
    Outside VO, but you probably have these WINAPI functions available: https://stackoverflow.com/questions/10787949/insert-into-windows-keyboard-buffer

    That's a little bit over my paygrade........
    I'll give the sample of Karl-Heinz a go.

    OK. Don't you initialize the search string you have the customer type in to navigate that list? Can't you set it to "R-" before calling the display routine? I don't do VO, but we have stuff like this in xHarbour...

    David A. Smith

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)