Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How do I set the Mh3dCombo Textcolor property and keep the individual color of the text on each line?

Posted on 2004-11-16
9
Medium Priority
?
394 Views
Last Modified: 2013-12-25
I have a problem with the Mh3dCombo box. I set the Textcolor property and then add the item, for each one
so,
cboTemp.TextColor = QBColor(9)
cboTemp.AddItem "Blue"
cboTemp.TextColor = QBColor(4)
cboTemp.AddItem "Red"
cboTemp.TextColor = QBColor(0)
cboTemp.AddItem "Black"

It all looks well when I drop down the combo box, but when i hover the mouse up or down, all items get re-painted to the last colour i used when adding the items, in this case Black.

Any ideas how to keep the colour as was at add time? maybe an API?
0
Comment
Question by:tiseffies
  • 5
  • 4
9 Comments
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 12601752

Use the ListTextColor property. This applies to individual entries. The TextColor propert applies to the whole control. These are extracts from the Help File

************************
The TextColor property sets or returns the color used to draw all text displayed in the control. Three colors are used when creating the 3-D effect for the control border and text: LightColor, ShadowColor, and TextColor.

Syntax
[form!]Mh3dCombo.TextColor[ = colorref& ]

Data Type
Color

Default Value
Black

***********************************

The ListTextColor property sets or returns the color used for the text in the specified line.

Syntax
[form!]Mh3dCombo.ListTextColor(index As Integer)[ = colorref& ]

Remarks
The parameters for the ListTextColor property are described below:

index%


Data Type
Color
0
 

Author Comment

by:tiseffies
ID: 12609843
This property behaves the same way for me as textcolor, except that when i hover up/down with the mouse on the combo it changes the colour to black! Here is  a snippet. Am I missing something?

Dim i%

do until rs001.eof
  cboTemp.AddItem rs001!field
  Select case rs001!field
    "Blue"
       cboTemp.ListTextColor(i) = QBColor(9)
     "Red"
       cboTemp.ListTextColor(i) = QBColor(4)
     "Black"
       cboTemp.ListTextColor(i) = QBColor(0)
  End Select
  rs001.MoveNext
  i=i+1
loop

I also tried setting the listtextcolor after the loop one at a time, after been added, same problem!
Thanks
0
 

Author Comment

by:tiseffies
ID: 12609923
Here is an interesting observation I made whilst testing this out. The style of my mh3dcombo is 2 - mhDropDownListCombo. When I change the style to 1 - MhDropDownCombo it works! But that is not a suitable style for me.
Any ideas?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Expert Comment

by:GrahamSkan
ID: 12609994
I don't think it's a colour thing.
This works OK for me.

Mh3dCombo1.AddItem "abc"
Mh3dCombo1.AddItem "def"
Mh3dCombo1.AddItem "ghi"
Mh3dCombo1.ListTextColor(0) = vbBlue
Mh3dCombo1.ListTextColor(1) = QBColor(4)
Mh3dCombo1.ListTextColor(2) = vbBlack
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 12610024
Sorry, didn't refresh.
I'm using style 2. Can't use 1 anyway, probably because I don't have a license. I only downloaded it to see what the problem was.
0
 

Author Comment

by:tiseffies
ID: 12610107
I tried your simple example in a new project. I still have the problem. Maybe I'm not explaining myself properly.
Click the arrow to drop down the combo, then move the mouse pretending you'll select something, so move the mouse over the drop down list, the color changes.
Also my version of the control is. MHCMBO32.OCX 5.1.0.20.
I can't think of anything else to try.
0
 

Author Comment

by:tiseffies
ID: 12611313
I found a workaround. I noticed that once I picked an item from the combo the problem goes away. That is if i drop the combo box down again, the colours are in place on the items.
So, If I add a blank item at the start of the combo and set the index to it, it won't change the colour of the items in the list, and the user still has to select an item like before. Not much of a change. I think i will go with that unless someone has a better idea (and can get my problem on his/her machine!)

Thanks
0
 
LVL 77

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 12612364
On my system, when the mouse cursor is over an item, the background color is black and the text changes to white, but the original colours are restored after the mouse pointer has moved away.

The good news is that my version is 7.0.0.33, so it's probably a fixed problem and you could update. Hopefully your license will still work, otherwise it's 149 dollars.

Home page:
http://www.becubed.com/Merchant2/merchant.mv?Screen=SFNT&Store_Code=B

Product page:
http://www.becubed.com/Merchant2/merchant.mv?Screen=PROD&Store_Code=B&Product_Code=031470
0
 

Author Comment

by:tiseffies
ID: 12621608
ok
i only had ole 7 sp10 to test with and that still gave me the problem, so i downloaded ole7 sp18 and that fixes the bug.
obviously there is not other workaround as it is a control bug/limitation so i will consider upgrading the control in my app.
thanks for your help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question