Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Combobox - mark text and place cursor at the end in the SLE part of the CB 01 Aug 2021 18:58 #19221

  • buddla59
  • buddla59's Avatar
  • Topic Author


  • Posts: 2
  • Hello,

    after more than 10 years of abstinence from VO, I have to make some changes in an application (VO 2.8 SP4b) for my previous client.

    Several combo boxes should be given an autofill function. This also works quite well so far. A text suggestion is written into the edit control of the combo box, only the cursor is placed at the beginning. However, the text change should be marked and the cursor should be placed at the end.

    I implemented the search for a text suggestion in '__EditChange'.
    METHOD __EditChange() AS VOID PASCAL CLASS cmbAutoFill
    
       //
       // CurrenText in dem Item-Array suchen 
       //
       
       LOCAL dwItemNo    AS DWORD
       LOCAL cValue      AS STRING
       LOCAL dwLenValue  AS DWORD
    
       SUPER:__EditChange() 
    
       cValue     := SELF:CurrentText
       dwLenValue := SLen(cValue)
    
       IF SLen(cValue) > 0
          IF (dwItemNo := AScan(SELF:_aItemList, {|x| Upper(x) = Upper(cValue)})) > 0     
             SELF:CurrentText := AllTrim(SELF:_aItemList[dwItemNo])
          ENDIF 
       ENDIF
    
    RETURN

    How can I solve the problem?
    SELF:selection := Selection {dwOldCurPos, -1}
    doesn't work or is not available.

    Thanks for the help and sorry for my bad english.

    Harry

    Please Log in or Create an account to join the conversation.

    Combobox - mark text and place cursor at the end in the SLE part of the CB 02 Aug 2021 07:35 #19224

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Harry,

    You must send the selection to the edit control of the combobox.

    SELF:CurrentText := AllTrim(SELF:_aItemList[dwItemNo])
    PostMessage( SELF:EditHandle , EM_SETSEL, 0 , -1 )   // <-------

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    Combobox - mark text and place cursor at the end in the SLE part of the CB 02 Aug 2021 16:38 #19226

    • buddla59
    • buddla59's Avatar
    • Topic Author


  • Posts: 2
  • Hi Karl-Heinz,

    thanks for the help. Works as it should.

    regards
    Harry

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1