Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

option button apperance??? 2

Status
Not open for further replies.

johnnyv

Programmer
Jul 13, 2001
216
CA
Hello all
This may be a bit of a rookie question but its driving me crazy.

I have 4 buttons on a form all part of an array. When the user selects 1 of the 4 buttons, the selected button changes from a grey colour to a green colour. No problem making this happen
But..
when button #1 is selected the buttons turns green in colour and a black hollow square also appears in the button.

With buttons 2-4 the buttons only appear green in colour when selected, there are no black "hollowed out squares" that are appearing when the buttons are in VBChecked state.

So what in holy #@#$! is wrong with button #1
I have compared the properties for each of the 4 buttons and other than their tab indexes and form positions, all properties are the same??

thanks in advance for all replys
 
Have you tried debugging, ie step through your code to see whats happening on clicking the first button. You might find the change in button 1 also causes the value/code or whatever affecting the others. Why not put your code on the site to see if someone spots your dilemma if its a coding problem. Someone else may have a better suggestion.
 
Zor

Thanks For the reply, I have stepped through the code and nothing happens to option button #0(The first button) that doesn't happen to the other 3 buttons. It is worth noting that if the button is assigned the value of vbchecked via tgeh code my problem does not appear. It only occurs when the button is selected by the user using the mouse. Here is the code.

Private Sub optQ1_Click(Index As Integer)
Dim icounter As Integer
' setting color for option buttons
For icounter = 0 To optQ1.Count - 1
optQ1(icounter).BackColor = &H8000000F
Next icounter
optQ1(Index).BackColor = &HFF00&
End Sub

there is a function call within this procedure that I have removed as part of this reply. I also commented the function call out of the code then ran it to confirm that this was not part of the problem. With the function call commented out the problem still occurred.

Once again thanks for the reply
 
I just put 4 Option buttons on a form and used your code. There were no problems, each turned green as it was clicked, the other reuming to grey. All my buttons show a black rectangle in them. I though at first it was because it had the focus, and tried passing focus to the form after the click but still there. I don't know whether this is part of the control that holds the on/off click picture that you can insert in properties. Apart from that over to anyone else out there that can throw any light. Re reading your text, I did not see it until now to try putting in a VBChecked= after the one with the index gets colored. Might do something
 
No, only Value=True/False, does not change appearance. Picture insertion on disabled and down, not as I thought it was on click. Think you are stuck with the black square/rectangle Regards
 
Zor thanks for the effort

A furthur note to complicate things a little more. When I enter the form and select opt buttons 2,3 or 4 for the first time the optbutton click event triggers and the button shows as being "checked" without a black rectangle. I then click the same button again, when it is in VBChecked state, and a black rectangle appears but no code is executed.
It all seems very strange to me I think the best thing to do is get rid of the buttons and add new ones with the same names.

With that said its friday afternoon and I am done for the day!!

2 stars for you, for taking the time to deal with such a "trival" matter!!
 
You can get this effect if you are using a Manifest file to get XP style controls or are using the winXP version of commctl32.dll . Try using an older version of commctl, that should work OK and nothing else will stop working !! Microsoft at their best again.
 
Thanks for the star. Its always the trivial ones that waste hours, nothing seems logical.
Anyway I used a checkbox, set its property to graphical, and put in the code below.

It seems to work well for me. Cannot remember if I made the tab stop false in properties, usually best. However the final setting focus takes away the ugly highlighted focus rectangle.

By the way, only 1 star works on this site per person, happy with 1. Good to give back something to the site.
Won't get sucked in to LordGarsdales comment on Microsoft, wouldn't be any room left on the site for threads. Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top