SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Feb 2001
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    button_set and multi arrays

    I have a set of checkboxes that have to be pre set differently depending on the test to be performed. For ease of maintenance, I have loaded up a two dimensional array with the checkbox identifier and the state to set them too (button_set; ON or OFF).
    I can return the ON/OFF value and I have the checkbox names right but it's not working right. If I pass all the boxes "ON" it turns them all OFF. I cannot set them ON.
    Any ideas?


    ------------------

  2. #2
    Member
    Join Date
    Feb 2001
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: button_set and multi arrays

    Fergeddit!
    I was passing text values to the button_set like
    customization[1,2] = "OFF";
    instead of
    customization[1,2] = OFF;

    Problem solved. Works like a charm.

    ------------------

  3. #3
    Senior Member
    Join Date
    May 2001
    Location
    Ankh-Morpork
    Posts
    2,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: button_set and multi arrays

    I'm just guessing here, but perhaps since ON and OFF are built in variables for the button_set() function, if you are reading in a value and using that variable for ON/OFF, it's giving the argument as the string "ON" or "OFF", rather than whatever numeric value WR actually assigns to those values.

    If this is the case, I see 2 ways around it. One would be if/else statements which test which value you've picked up from your table, then executing the command with the desired option:
    <pre>myButton = [some button object];
    myButtonStatus = [some data table value];
    if(myButtonStatus == "ON") {
    button_set(myButton, ON);
    }
    else {
    button_set(myButton, OFF);
    }</pre>

    Optionally, you could use an eval() statement to do it in one command:
    <pre>myButton = [some button object];
    myButtonStatus = [some data table value];
    eval("button_set(myButton, " & myButtonStatus & ");");</pre>

    ------------------
    Charles Reace

    charles{DOT}reace{AT}verizon{DOT}net
    web site | [url=http://www.ebookworm.us/[/url]

    [i]...Sound trumpets! Every trumpet in the host! / Sixty thousand, on these words, sound, so high the mountains sound, and the valleys resound.&lt;/i] (The Song of Roland)

  4. #4
    Senior Member
    Join Date
    May 2001
    Location
    Ankh-Morpork
    Posts
    2,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: button_set and multi arrays

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Jake:
    Fergeddit!
    I was passing text values to the button_set like
    customization[1,2] = "OFF";
    instead of
    customization[1,2] = OFF;

    Problem solved. Works like a charm.
    <HR></BLOCKQUOTE>
    Aw, darn, I did all that typing for nothing?

    Glad you got it to work.


    ------------------
    Charles Reace

    charles{DOT}reace{AT}verizon{DOT}net
    web site | [url=http://www.ebookworm.us/[/url]

    [i]...Sound trumpets! Every trumpet in the host! / Sixty thousand, on these words, sound, so high the mountains sound, and the valleys resound.&lt;/i] (The Song of Roland)

  5. #5
    Member
    Join Date
    Feb 2001
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: button_set and multi arrays

    OK, how 'bout this then;
    When I try and use the fruits of my labor to do the button_set, like so:

    for (counter=1; counter<14; counter++){
    button_set(customization[counter,1], customization[counter,2]);
    }

    ...it works fine if I do it in an inline script but if I try and put it in a function (that lives in my called/external "functions" script), it chokes with an "Error: Variable counter has not been declared".

    Sure would be nice to set it up as an external function.
    What's the deal?


    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:28 AM.

Copyright BetaSoft Inc.