Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Posts
    1

    need help with buttons toggle state and setting properties

    I have a checkbox (a toggle button) on my page and an input field. I want to use the checkbox to specify whether the Input field should be a password field or a normal input field. In other words, I want to give an option on whether the user wants to mask the input field or not.

    Any idea how I could achieve this?

  2. #2
    Join Date
    Nov 2006
    Location
    Quebec, Canada.
    Posts
    432
    Well, here's a start. It's not complete... but a start.

    So set your button attribute to Toggle with default UP and add this on the OnClick event of that button:

    Code:
    result = Button.GetState("Button1");
    
    if result==BTN_UP then
    ---Standard Input
    Input.SetProperties("Input1", tblInputProps.InputStyle);
    else
    ---Password (masked) Input
    Input.SetProperties("Input1", tblInputProp.InputStyle);
    end
    I just need to find how to handle tables XD, as it needs to be a table...

    Hope this helps!
    FoxLeader

  3. #3
    Join Date
    Nov 2006
    Location
    Quebec, Canada.
    Posts
    432
    Yeah! By helping you, I helped myself to learn

    So here's the final code:

    Code:
     01 result = Button.GetState( "Button1");
     02 tpProperties = {};
     03 tpProperties.InputStyle = INPUT_PASSWORD;
     04 tProperties = {};
     05 tProperties.InputStyle = INPUT_STANDARD;
     06 if result==BTN_UP then
     07 ---Standard Input 
     08 -- Create properties table (only include items that should be changed) 
     09 -- Set the properties of an input object 
     10 Input.SetProperties( "Input1", tProperties); 
     11 else 
     12 -- Create properties table (only include items that should be changed) 
     13 -- Set the properties of an input object 
     14 Input.SetProperties( "Input1", tpProperties); 
     15 end
    output enhanced with AMS Code Pretty

    P.S: That code was easier to view, perhaps copy this one in your app, on the OnClick event:
    Code:
    result = Button.GetState("Button1");
    tpProperties = {};
    tpProperties.InputStyle = INPUT_PASSWORD;
    tProperties = {};
    tProperties.InputStyle = INPUT_STANDARD;
    if result==BTN_UP then
    ---Standard Input
    -- Create properties table (only include items that should be changed)
    -- Set the properties of an input object
    Input.SetProperties("Input1", tProperties);
    else
    -- Create properties table (only include items that should be changed)
    -- Set the properties of an input object
    Input.SetProperties("Input1", tpProperties);
    end

  4. #4
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    You can also do it with less code.

    Code:
    if result==BTN_UP then
        -- Standard Input
        Input.SetProperties("Input1", {InputStyle=INPUT_STANDARD});
    else
        -- Password Input
        Input.SetProperties("Input1", {InputStyle=INPUT_PASSWORD});
    end
    Dermot

    I am so out of here

  5. #5
    Join Date
    Nov 2006
    Location
    Quebec, Canada.
    Posts
    432
    AH! I tried a similar way, but it didnt work. So thanks for the input, I'll remember this!

Similar Threads

  1. Setting z-order for buttons
    By kmartin7 in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 08-23-2004, 02:09 PM
  2. Example: Creating an on/off button to toggle background audio
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 07-10-2004, 02:54 PM

Posting Permissions

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