Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2002
    Posts
    57

    "Checkbox" button state and labels

    I have the following code in the onClick event for a label:

    isChecked = Button.GetState("checkbox");
    if (isChecked ~=true) then
    Audio.ToggleMute(CHANNEL_BACKGROUND);
    Button.SetState("checkbox", BTN_DOWN);
    isChecked = true;
    else
    Audio.ToggleMute(CHANNEL_BACKGROUND);
    Button.SetState("checkbox", BTN_UP);
    isChecked = false;
    end

    I am trying to allow the user to click on the label and set an associated button's (checkbox) state. When I click on the label, the background music toggles like it should, and changes the button state to BTN_DOWN, but when I click it again, the music toggles but the button state does NOT change. Any ideas?

    Kurt

  2. #2
    Join Date
    Nov 2003
    Location
    Salzburg / Austria
    Posts
    312
    change
    if (isChecked ~=true) then
    to
    if (isChecked ~=1) then



    take a look at the manual
    Actions / Buttons / Button.Get State
    Returns
    (number) The current state of the button:

    CONSTANT VALUE DESCRIPTION

    BTN_UP 0 Button is up (normal).

    BTN_DOWN 1 Button is down (pressed).




    Stefan_M
    "With a rubber duck, one's never alone."

    Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    Kurt,
    Just a quick point.
    You want the user to click on a label and have a button change visually?
    I would think the opposite would make more sense. One tends to click on what looks as abutton, and then, you can have something else (label, image...) changing accordingly.
    I don't know what you intend to do and I may be WAY offline here, and if so..sorry about that.

    Yossi

  4. #4
    Join Date
    Jun 2002
    Posts
    57
    Stefan,

    That did the trick. For some reason, I thought I tried 1 instead of true, and got the same result...

    Yosik,

    If they click the button, they get the same effect. Clicking labels is pretty much a Windows form standard now, that if you click the checkbox or associated label, it will toggle the checkbox.

    Kurt

  5. #5
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by kmartin7
    Stefan,

    That did the trick. For some reason, I thought I tried 1 instead of true, and got the same result...

    Yosik,

    If they click the button, they get the same effect. Clicking labels is pretty much a Windows form standard now, that if you click the checkbox or associated label, it will toggle the checkbox.

    Kurt
    I like this feature! When keyboard navigating it's not important. But, when I am zooming through an install... It's nice to not have to get exactly on the dang option button, for example.
    Intrigued

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts