Alpha Video Training
Results 1 to 2 of 2

Thread: Radio Buttons

  1. #1
    Bruce Roberson
    Guest

    Default Radio Buttons

    I am trying to figure out how to implement a radio button that would allow a person to choose a product to report on, in combination with the dialog box that comes up in this xbasic script.

    I got help with this before and this script here basically allows a user to choose beginning and ending months and years to report on, and then in the last it allows the user to choose a well name from the dialog box, and then the report is previewed.

    So, I need to figure out how to incorporate the radio button which I thought would be the easiest way to have the user choose what product to report on. the choices are Oil, Gas, or All Products, and I have put a radio button box on the form, and have copied a script out of the xbasic manual and changed the choices. I have attached the script to the "On Arrive" event and it tabs to the radio button box after the beginning and ending months are chosen but before the user chooses the well name.

    The thing is as it stands right now, a dialog box comes up instead of seeing the dot beside the choice I make. So, I am sure it is just that I cannot understand how to use this feature from reading just the xbasic manual.

    My script so far aside from the radio button actions are shown below:




    ''XBasic
    dim welllisting(1024) as c
    dim inputf as p
    dim name as c
    dim global wellname as c
    dim global namex as c
    dim i as n
    dim prevname as c
    dim currname as c
    prevname=""
    'Set initial values to null (empty) strings
    currname=""
    inputf=table.open("mmsprp",file_ro_shared)
    inputf.index_primary_put("Property")
    i=1
    inputf.fetch_first()
    prevname=alltrim(inputf.new_prprty)
    'Set prevname var to first wellname in list
    while .not. inputf.fetch_eof()
    if prevnamecurrname then
    'currname is not same as prevname, so
    welllisting(i)=inputf.new_prprty
    ' add it to the array. Otherwise don't.
    prevname=currname
    'Assign value of currname to prevname, since
    end if
    'it has now been added to the array. If next
    inputf.fetch_next()
    'record has same value, it will be skipped.
    currname=alltrim(inputf.new_prprty)
    'put trimmed value of new_prprty in var
    i=i+1
    end while
    name=ui_get_list_array("Select your well",1,"welllisting")
    namex=substr(name,1,25)
    inputf.close()
    if name"" then
    'user did not cancel, so
    report.preview("Report by Well Name")
    'ok to preview report. Otherwise don't
    end if
    end

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Radio Buttons

    Bruce,

    I've read your message twice and don't understand either the context of what you're attempting, or what it is exactly that you need help with.

    Perhaps a couple of general comments will help.

    1) If you only have three choices for the product type and you want the user to pick one of the three, and you don't want to display the choices except while the script is running, I'd use ui_get_list() to popup the choices and let the user pick one. I suppose it's possible you're using ui_get_radio(), but so far you haven't said so. If so, it should work the same as ui_get_list().

    2) If you prefer to have the radio buttons on the form all the time, then my script would simply check the setting from the radio button object instead of tabbing to it. There's no reason to set focus on the radio button object just to read the value selected by the user.

    -- tom

Similar Threads

  1. Multistate & Radio Buttons
    By Tom Cone Jr in forum Code Archive
    Replies: 1
    Last Post: 05-16-2005, 03:18 PM
  2. radio buttons redux
    By Chuck Lafean in forum Alpha Five Version 6
    Replies: 1
    Last Post: 12-13-2004, 04:18 PM
  3. radio buttons
    By dik_coleman in forum Alpha Five Version 6
    Replies: 15
    Last Post: 12-12-2004, 05:40 PM
  4. Radio Buttons
    By Jeff, Richards in forum Alpha Five Version 5
    Replies: 14
    Last Post: 11-23-2003, 09:02 AM
  5. Radio Buttons
    By TerriH in forum Alpha Five Version 4
    Replies: 5
    Last Post: 09-21-2001, 05:12 AM

Bookmarks

Posting Permissions

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