Home All Groups Group Topic Archive Search About

Some Trouble with SSTAB and ComboBoxes

Author
18 Nov 2007 10:49 PM
Karl Fuchs
Hello,

I have some User Forms with SSTab-Controls and ComboBoxes on it. My
problem is:
When I change the TAB´s, in each of the comboBoxes the selected Item
appears highlighted, like after the User had selected it and before
leaving the control.
Is there any way to avoid this?

I think, I had seen a solution anywhere, but this evening Google ist
not my friend at all.

Thank you in advance.

Karl

Author
19 Nov 2007 12:23 PM
Larry Serflaten
"Karl Fuchs" <f***@ivsn.com> wrote
I have some User Forms with SSTab-Controls and ComboBoxes on it. My
problem is:
When I change the TAB´s, in each of the comboBoxes the selected Item
appears highlighted, like after the User had selected it and before
leaving the control.
Is there any way to avoid this?

I think, I had seen a solution anywhere, but this evening Google ist
not my friend at all.


---

What response do you want them to have?

When you "change the TAB's",  you might go through and set all
the ListIndex values of the comboboxes to -1, meaning nothing is
selected....

LFS
Author
19 Nov 2007 4:53 PM
Karl Fuchs
Hello,

>
> What response do you want them to have?
>
> When you "change the TAB's",  you might go through and set all
> the ListIndex values of the comboboxes to -1, meaning nothing is
> selected....
>
> LFS

thank you, but this is not the problem... The value should not be
changed, but the selected  Item should not be highlighted.
Meanwhile I found out, that this is a problem of SSTAB Control; one
solution is, to place the controls of each TAB in a frame. At the
moment I search for a solution using SendMessage with CB_SETEDITSEL;
however part of the Items of Comboboxes sometimes are still
highlighted, if the selected Item has more than 18 characters.
But I think, this will be another thread ...

Karl
Author
19 Nov 2007 6:14 PM
Rick Rothstein (MVP - VB)
Show quote
>> What response do you want them to have?
>>
>> When you "change the TAB's",  you might go through and set all
>> the ListIndex values of the comboboxes to -1, meaning nothing is
>> selected....
>>
>> LFS
>
> thank you, but this is not the problem... The value should not be
> changed, but the selected  Item should not be highlighted.
> Meanwhile I found out, that this is a problem of SSTAB Control; one
> solution is, to place the controls of each TAB in a frame. At the
> moment I search for a solution using SendMessage with CB_SETEDITSEL;
> however part of the Items of Comboboxes sometimes are still
> highlighted, if the selected Item has more than 18 characters.
> But I think, this will be another thread ...

I'm not exactly sure where you should place this given what I think you are
describing; however, you can force the highlight in a ComboBox to be off by
executing this line...

    Combo1.SelStart = Len(Combo1.Text)

Off the top of my head (meaning... I didn't try it out), perhaps you can set
up a "User Form" wide flag variable and set it to True when a new tab is
selected and then put this in each of your ComboBox GotFocus events...

    If FlagVariable = True Then
      ComboX.SelStart = Len(ComboX.Text)
      FlagVariable = False
    Else
      '
      '  Your actual ComboBox code goes here
      '
    End If

where ComboX is the name of the ComboBox into whose GotFocus event the code
is placed.

Rick

AddThis Social Bookmark Button