Get a Jumpstart with our Sample Apps
Results 1 to 1 of 1

Thread: Add a Toggle Button to a Browse

  1. #1
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,207

    Default Add a Toggle Button to a Browse

    I have recently been re-visiting the function of a two-state button on a form and thought that would be great to be able to do in a browse. I have a logical field in my table, STATUS that uses a somewhat reverse logic to show Active and Inactive records. The default is .F. for Active and .T. for Inactive so the user only needs to make a status change if the record is no longer a valid choice. Its just one less step on data entry since a new record is undoubtedly considered active at that time. On the form the button text toggles "Active" and "Inactive", but on the browse under the Active column I just want it to say "Yes" or "No" - (which a checkbox doesn't do in case anyone was thinking why didn't I just do that. The answer is because then I can change the font color so INACTIVE stands out - see the dynamic properties for the form button & also properties using font and color equations)

    To do this in a browse I added a Generic button from the Browse Control toolbox. I set the display as text only and discovered there was an expression smart field available to define the text. Since the button is System->Unbound, ie. not bound to a field in the table, I used an if() condition to test the status field's value: if(status,"No","Yes") - (sounds simple but took me a while to figure that out).

    Click on the Actions ('Active') column (initially will say Generic - you can change that) to highlight and select Edit Display Format from the right click menu (if the column is narrow you may have to widen it to get that menu option to show up). Choose 'all rows have the same display format', then click Edit Display Format to add the button and edit the code. Also add the Justify selection above the button so it is centered in the column. Actually you could just add a 'normal' button and include a text object next to it, but that's not what I wanted to do.

    Since I have 2 buttons in this browse, there are 2 functions added to the browse Events-Events, the Actions2_Buttonclick event is the one for this button. All it does is - based on the current value of the status field for the current record (which is not displayed in the browse); changes the underlying table record then calls for a repaint of the button so the calc expression can show its new value.

    I hope others who post here will help keep the desktop alive by showing all the nifty things that can be done using Alpha's built in tools. Most of the old links are gone in here so this is my hopeful attempt to bring 'em back!

    BrwBtn_170115.zip
    Last edited by MoGrace; 01-15-2017 at 05:48 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

Similar Threads

  1. Set/toggle a textbox field to read-only using a button
    By Ken Tjia in forum Mobile & Browser Applications
    Replies: 0
    Last Post: 11-02-2013, 10:39 PM
  2. How to work with a Toggle button/ button to make relation with database field?
    By Suvarchala in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 01-02-2012, 07:50 AM
  3. Form and Browse toggle
    By LeeG in forum Alpha Five Version 6
    Replies: 16
    Last Post: 01-13-2008, 06:20 PM
  4. Toggle form / browse
    By Bill Parker in forum Alpha Five Version 5
    Replies: 2
    Last Post: 09-03-2004, 07:35 AM
  5. How to toggle browse/view as A4
    By Steve Pick in forum Alpha Five Version 5
    Replies: 7
    Last Post: 12-30-2002, 04:48 AM

Posting Permissions

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