Re: Unexplainable behavior

new topic     » goto parent     » topic index » view thread      » older message » newer message

CChris wrote:
> 
> Mike777 wrote:
> > 
> > Greg Haberek wrote:
> > > 
> > > Mike777 wrote:
> > > > 
> > > > I'm posting this follow up under a new subject because I'm at my wits
> > > > end on
> > > > this and would like somebody (anybody?) to take another look to see if
> > > > anything
> > > > pops out.
> > > > 
> > > > I have a handler for a checkbox onClick event that I want to fire when
> > > > the
> user</font></i>
> > > > clicks on a label to the left of the checkbox.  I would presume this is
> > > > fairly
> > > > common behaviour.
> > > 
> > > I'm gonna stop you right there. I don't presume this to be common practice
> > > at
> > > all. You're kind of re-inventing the wheel here. If you give a CheckBox a
> > > title
> > > when you create it, that text will appear to the right of the box, and be
> > > click-able
> > > and trigger onClick (w32HClick) events automatically. I see no sense in
> > > creating
> > > an additional label to receive the click events. If all you want is to
> > > place
> > > the label on the left side of the box, just use the BS_LEFTTEXT style.
> > 
> > Greg,
> > 
> > I'd be happy to give this a try.  Is there a method whereby I can reset the
> > text to appear with respect to the control I already have?  The control is
> > referred
> > to a number of places in the code and if I delete that control and replace
> > it
> > with a new one it will take me quite a while to hunt down all the places
> > that
> > the name has to be edited.  I've already tried setting the BS_LEFTTEXT
> > style,
> > but it doesn't seem to have any impact on the existing checkbox.
> > 
> > Thanks
> > 
> > Mike
> 
> Could you post the statements that create the checkbox and the label? That
> would
> help deciding whether your design is weird from Windows' standpoint or not.

Here's the code that is generated by the IDE for the checkbox:

constant chkMyCheck = createEx( CheckBox, "chkMyCheck", Window1, 230, 571, 13,
20, 0, 0 )
setFont( chkMyCheck,"MS Sans Serif",8,Normal+Bold)

Here's the code that is generated by the IDE for the label:

constant lblchkMyCheck = createEx( RText, "Use the first one?  ", Window1, 80,
571, 146, 20, 0, 0 )

> In case this is the issue, a checkbox comes with a label already. By default,
> it displays on the right of the small square, and you can switch it to the
> left
> as Greg mentioned. Did you, by any chance, create the checkbox with an empty
> caption and then a label to hold the text? This is usually uselessly complex,
> set the checkbox caption instead.

The message you are responding to indicates that I am attempting to do that and
failing.  BTW, I had done this originally because I wanted the text to be a bit
more fancy than I could get the attached label to appear as.  I've since given up
on that so if I can just restore the label to the check I'd be happy (if clicking
it once does what it is supposed to do, which it should, but then again what I've
currently got "should").
 
> btw Derek: setCheck() only sends the BM_SETCHECK message to the button, which
> has no effect other than toggling the check mark, assuming the style of the
> button defines any.

?123 didn't do anything for me (I don't seem to get a box of any sort showing up
anywhere, although I suppose I just didn't look in the right spot).  Instead, I
created a global integer and +=1'd it and then I display it in the status bar. 
It proves that my execution count was correct.  It increments by one when I click
the checkbox (slow or fast).  It increments by one if I leave the sleep(1) in
place or I hold down the left click for a long time.  It increments by two if I
click quickly without a sleep(1).

Mike

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu