2 Second Button Press Activation

I'm working on a touchscreen application and I have a basic control that has large buttons on it. I want to make the buttons only activate if the user has held his/her finger on the button for 2 seconds or more. I'm using  Mouse Down event structures to detect the button presses, BUT how do I make the user hold the button down for 2 seconds before the button actually activates?
Ideally I would love to just be able to "hold for 2 seconds" and have it trigger as opposed to "hold for 2 seconds and release" but I can't get either to work. Thanks folks and we got a weekend coming up!
-- Matt

Here is a VI (LV8.20) that does what you want, mostly. It uses Mouse Down, Mouse Up, and Mouse Leave events to control a timer and to toggle a boolean indicator. Mouse Down on th ebutton starts the timer. Mouse Up or Mouse Leave before the 2 seconds causes the timer to stop. If the mouse stays down on the button for more than two seconds, the indicator state toggles.
If you are using other events, this likely will not work properly in all cases. A better approach might be to put the timer into a parallel loop (rather than the timeout case) and just send messages via a queue about which events have occurred.
Lynn
Attachments:
Two Seconds.vi ‏19 KB

Similar Messages

  • Prevent second button press during long process

    How do I prevent a second (third, forth...) button presses during a repeat loop.
    on doLongProcess()
    --repeat loop
    end doLongProcess
    on clicked theObject
    if name of theObject is "btn_1" then
    -- I tried; set enabled of button named "btn_1 " to false, but got an error
    doLongProcess()
    end if
    end clicked

    WHY IS of window 1 SO IMPORTANT IN A [NON
    DOCUMENT] APPLICATION?!
    Non-document apps can still have multiple windows. And you could have buttons with the same name in more than one window so you need to let AS Studio know which button in which window.
    I generally give my windows an AppleScript name in Interface Builder and use the window name instead of the window number. It seems to make a little more sense to me.
    <pre>
    set enabled of button "Do It" of window "My Window" to false
    </pre>
    Steve

  • Macbook air 2013 needs power button pressed for 10 seconds before it turns on?

    macbook air 2013 needs power button pressed for 10 seconds before it turns on? also I've tried resting PRAM but when i press the 4 buttons before the start up screen it never restarts again? please help!

    Reset SMC.     http://support.apple.com/kb/HT3964
    Choose the method for:
    "Resetting SMC on portables with a battery you should not remove on your own".
    If this does not help, contact Apple.
    Genius Bar reservation:
    http://www.apple.com/retail/geniusbar/
    Best.

  • My mac book pro 17" model 1229 does not work. It askes' me to :'you need to restart your computer.Hold down Power button for several seconds or press the Restart button

    Mac book pro 17" model 1229 displaying: "you need to restart your computer. Hold down the power button for several seconds or press the Start button

    Your MBP may have had a kernel panic.  If so, post the kernel panic per these instructions:
    http://support.apple.com/kb/ht2546
    An Apple Hardware Test may be useful:
    http://support.apple.com/kb/ht1509
    Note that an error free AHT is not definitive.
    Ciao.

  • Command button always pressed/activated

    Hello,
    I got a problem with my main username.
    I don't know what happened, but it seems that I did a key sequence with the result that my command/apple key is always pressed/activated.
    It's just on my main username so that it won't be a hardware fault.
    I need your help guys :-)
    Thanks a lot.

    A few more informations
    My macbook felt a few times on the floor, once on the corner where the power button is located (...), but it was a few months, or a few years ago, and it didn't show the power button's problem before today
    Since a few weeks, my trackpad stopped clicking
    My battery says since a year or more "service battery", so it could may be battery-related ?
    ....Yeah, this Macbook is kind of screwed, but I'd like to keep it alive

  • Produce second pulse from latch button press

    Hi,
    I would like to generate a second latch pulse from a single press of a latching Boolean type button.
    I currently have two buttons - the user presses the first (it performs a "reset" type operation) then presses the second button (for a "capture"). A reset must be performed before the capture, and my code is written so that both work with Latch When Pressed mechanical action.
    I have tried using Switch When Pressed mech action and performing eg. Reset on True and Capture on False, but this doesn't work for other reasons within the code.
    What I would like is for one press of a single button to generate two pulses: a first pulse I can connect to the "reset" piece of code, then a short delay, and then a second pulse I can connect to the "capture" piece of code.
    thanks,
    Kathryn

    Hi RavensFan and other forum members,
    I'm sorry if this thread is a stupid question, and I hope I was clearer in my second post. I dont' feel I can use a Waveform for the selector of a case statement, I created a waveform in the shape of a pulse, and did a "greater than" comparison with the magnitude of the waveform I created but this creates a Boolean array, which I don't think will work for the case statement selector. If I am wrong here, can you please give more detail as to how I can use a waveform to create two Boolean pulses to use for two separate case statement selectors.
    I am looking at two options, either will work:
    1. Using a switch in Latch When Pressed mode, two Boolean pulses are created, one after the other with a time gap, for the selector of two separate Case statements.
    2. Using a switch in Switch When Pressed mode, one pulse is created on a rising edge and a second on a falling edge. In this case, the problem may be how to create a Boolean pulse from a step change in sense.
    The Boolean signals have to be F-T-F pulses rather than held True.
     Any help appreciated...
    thanks,
    Kathryn

  • Problem while hide a block on selection screen on button press

    Hi,
    I have added two buttons on the application toolbar of the selection screen. I have input fields under two blocks on the selection-screen. Initially the second block is hidden. If I press the button 1 the second block should be made visible.
    For this to happen, I captured the button 1 click event using the following statement.
    IF sscrfields-ucomm = 'FC01'.
    Inside the if ... endif, I looped at the screen and made the second block visible. It was working fine.
    loop at screen.
      if screen-group4 = '013'.
         screen-invisible = 1.
         screen-active    = 0.
      endif.
    endloop.
    Later the second button was added. Now when i run the report for the first time, if button 2 is clicked the hidden block appears on the selection screen even though i have not added any code for it.
    Just to check, i commented the logic to display the hidden block on button 1 click event. Even without any code the first time i press any of the two buttons added on the application toolbar the hidden block is displayed.
    I saved a variant for the report.
    During execution of the report, if i select any variant then the hidden block is displayed.
    Can anyone please tell me how to fix this problem.
    Regards,
    T2.

    Hi All,
    The problem is solved.
    Everyone was confusing between the pushbutton on the selectio-screen and on apllication toolbar
    (where you have the execute icon).
    Please find the code below. Thanks for you time and help. I appreciate it.
    REPORT ztest.
    INCLUDE <icon>.
    *  TABLES                                                              *
    TABLES: t001,              " Company Codes
            lfa1,              " Vendor Master (General Section)
            sscrfields.        " Fields on selection screens
    * To capture button press event.
    DATA: gv_button_press       TYPE c.
    * Menu Painter: Program interface for dynamic texts
    DATA: gs_dyntxt             TYPE smp_dyntxt.
    *  SELECTION SCREEN                                                    *
    SELECTION-SCREEN FUNCTION KEY 1.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-s01.
    * Company Code.
    SELECTION-SCREEN BEGIN OF BLOCK ccode WITH FRAME TITLE text-s02.
    SELECT-OPTIONS: s_bukrs FOR t001-bukrs OBLIGATORY MEMORY ID buk.
    SELECTION-SCREEN END OF BLOCK ccode.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK dsel WITH FRAME TITLE text-s04.
    * Vendor Master.
    SELECTION-SCREEN BEGIN OF BLOCK vend WITH FRAME TITLE text-s07.
    SELECT-OPTIONS: s_konzs FOR lfa1-konzs MODIF ID aw1.
    SELECT-OPTIONS: s_txcd1 FOR lfa1-stcd1 MODIF ID aw1.
    SELECT-OPTIONS: s_txcd2 FOR lfa1-stcd2 MODIF ID aw1.
    SELECTION-SCREEN END OF BLOCK vend.
    SELECTION-SCREEN END OF BLOCK dsel.
    * INITIALIZATION                                                       *
    INITIALIZATION.
    * Populate the Application toolbar button attributes.
      PERFORM populate_app_toolbar_buttons.
    * Hide the dynamic screen intially.
      PERFORM hide_screenfields.
    * AT SELECTION SCREEN                                                  *
    AT SELECTION-SCREEN.
    * Capture the button press event.
      PERFORM capture_button_press.
    * AT SELECTION-SCREEN OUTPUT.                                          *
    AT SELECTION-SCREEN OUTPUT.
    * Show/Hide the dynamic selection screen based on button press.
      PERFORM adapt_screen.
    *&  Form  populate_app_toolbar_buttons                                 *
    *   Display Icon on the application toolbar buttons. Also set the      *
    *   function codes for these buttons.                                  *
    FORM populate_app_toolbar_buttons.
      CLEAR gs_dyntxt.
      WRITE icon_fencing     TO gs_dyntxt-icon_id AS ICON.
      MOVE  text-b01         TO gs_dyntxt-quickinfo.   " Dynamic Selections
      MOVE gs_dyntxt         TO sscrfields-functxt_01.
    ENDFORM.                    " populate_app_toolbar_buttons
    *&  Form  hide_screenfields                                            *
    *   Initially hide the Dynamic selection screen.                       *
    FORM hide_screenfields.
      LOOP AT SCREEN.
        IF screen-group1 = 'AW1'.
          screen-invisible = '1'.
          screen-active    = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    ENDFORM.                    " hide_screenfields
    *&  Form  capture_button_press                                         *
    *   Set the flag based on button press event. Appication bar button    *
    *   tcode is available only at 'At Selection-screen' event.            *
    *   Use the captured data at 'At Selection-screen Output' event.       *
    *   Screen adjustments is possible only under this event.              *
    FORM capture_button_press.
      IF sscrfields-ucomm = 'FC01'.
        IF gv_button_press IS INITIAL.
          gv_button_press = 'X'.
        ELSEIF gv_button_press EQ 'X'.
          CLEAR gv_button_press.
        ENDIF.
      ENDIF.
    ENDFORM.                    " capture_button_press
    *&  Form  adapt_screen                                                 *
    *   Show/Hide the dynamic selection screen based on button press       *
    *   captured at 'At selection-screen' event.                           *
    FORM adapt_screen.
    * If button press flag is initial hide the dynamic selection screen.
      IF gv_button_press IS INITIAL.
        LOOP AT SCREEN.
          IF screen-group1 = 'AW1'.
            screen-invisible = '1'.
            screen-active    = '0'.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
    * Elseif button press flag is 'X' show the dynamic selection screen.
      ELSEIF gv_button_press EQ 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'AW1'.
            screen-invisible = '0'.
            screen-active    = '1'.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " adapt_screen
    Regards,
    T2
    Message was edited by: Titu Joseph

  • Change control values on button press

    Hi, I've got a situation where I have several numeric controls where you can change different values. I also have several subVIs with control references (as described in this article: http://labviewwiki.org/Control_References) that takes in references to these numeric controls on the mainVI. These subVIs continously read the values in their own threads.
    So whenever I change a value on any of the controls, the values does of course change in the subVIs, since they reference to the value of the control.  How would I make the actual value only change only after I clicked the ok button?
    To illustrate this I made a VI with an event structure and a separate while loop that continoulsy reads a reference to the control and updats an indicator. I can think of a few cumbersome solutions, whereas I have two controls for every value. The second control would then be hidden and only written to in case of the Ok button press. But having two controls to do something simple as this seems superfluous.
    Message Edited by Siniz on 10-20-2009 10:36 AM
    Solved!
    Go to Solution.
    Attachments:
    ValueChangeOnButtonPress.vi ‏19 KB

    Given what you want to do then I would suggest that you use an Action Engine to contain your data. This has the advantage of decoupling the UI from the subtasks. I would recommend that your action engine consist of an array of clusters. Each cluster would contain the data values, in your case Ki, Kd and Kp for each controller. This has the advantage of reducing the individual values you are dealing with and treats the data for a given controller as a whole. The subtasks could either poll the data looking for a value change. You could even keep track of that in your Action Engine so you would only need to poll to see if the data changed. If it did, then read the data. You would need an index or ID to specify which controller's data you would want to access. The action engine allows you to grow your application if more controllers are added. You should use a typedef to define the cluster. If you wanted to make this more event driven you could use a single notifier shared by your subtasks that would simply indicate a data change event. Part of the data for the notifier could specify which data. That way only interested subtasks would take action. This type of architecture wouldn't add lots of wires to your diagram especially if you used a named notifier.
    Regardless of the way you choose to pass the data to the subtasks I would take a look at your UI. I haven't seen it so I can't comment on it specifically. However is you have 40 controls on the front panel at the same time it most likely is a confusing interface. There are ways to reduce the complexity and still provide the same functionality. If you haven't already looked at I would recommend getting the book The LabVIEW Style Book by Peter Blume. If you did reduce your UI to only work with a single controller or a couple of related controllers at a time the Action Engine approach would work nicely since you take your data from the FP and only update the data that has changed. From a UI perspective you have less controls to worry about on your UI and it will probably be easier for the user to understand. From the application's perspective you have decoupled the subtasks from the UI in a very clean way. Another approach would be to use LVOOP for your controller data and processing. Then you simply instantiate a new instance of the class (an object) for each controller that your system is using. This has an added benefit of allowing you to use different controllers and load them at runtime using dynamic dispatching.
    PS You are good for the overall Kudo count. Thanks.
    Message Edited by Mark Yedinak on 10-20-2009 12:33 PM
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Help-I Need to hold a Abstract button pressed

    hi,
    I have captured a button instance from abbot. I need to hold the button pressed for 2 seconds without releasing.
    I need to know, how to do it?
    Pressing the button for more than 2 seconds without releasing will popup a menu.. i need to get the instance of the menu too...
    How can i do that, either through Java or with Abbot.
    Thanks,
    With Regards,
    Priyaa.

    what the heck is Abbot?I thought everyone knew about [url http://www.jahozafat.com/TV_Shows/Abbott_And_Costello/hey_abbott.wav]Abbot.

  • How is when a button pressed a report will come to the same page !!!

    Hi all,
    I wonder that is it possible to bring a report to the page as a region but only when a button pressed in apex .When ı clicked the go button for example ı want to list a report in the same page.
    but I dont know how .If is this possible can you explain me please.I need help!
    Thanks!

    Create your report in a region as normal.
    Create a second region and in this region create an item eg p171_item.
    In the same region create 2 buttons
    Get Report and Reset (branching back to same page).
    Create 2 page processes (PLSQL) on submit after computations
    1. GET REPORT
    DECLARE
    v_item number;
    Begin
    select 1 into v_item from dual;
    :P171_ITEM := v_item;
    end;
    2.RESET
    DECLARE
    v_item number;
    Begin
    select 2 into v_item from dual;
    :P171_ITEM := v_item;
    end;
    Tie the processes to the buttons.
    On your report region put a condition
    PL_SQL RETURNING BOOLEAN
    IF :P171_ITEM = 1 THEN
    RETURN TRUE;
    ELSE
    RETURN FALSE;
    END IF;
    Now by pressing the buttons the report region is opened and closed.
    Now hide P171_ITEM.
    Gus

  • Worst update ever! On my Vista everything is wrong! Back button never active; If I want open pages as new tab it opens new window; FF starts with blank page instead of Google; No url address shown on status bar when I move mouse arrow on the link etc

    Worst update ever! On my Vista everything is wrong! Back button never active; If I want open pages as new tab it opens new window; FF starts with blank page instead of Google; No url address shown on status bar when I move mouse arrow on the link etc.. Please Help!

    Try the Firefox SafeMode to see how it works there. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    * You can open the Firefox 4.0+ SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    '''''If it is good in the Firefox SafeMode''''', your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes
    ''When you figure out what is causing that, please let us know. It might help other user's who have that problem.''

  • Flv "white flash" in between videos playing when button pressed.

    I am currently working on a catalyst project whereby the buttons pressed play different sections of an animation. My problem is that the animation flashes white for a split second in between pressing the button and the video playing. Does anyonyone know how to eliminate this white flash? Would really appreciate any help,
    Cheers,
    Dan

    Hello all,
    Yes to follow up Ben, I'm experiencing the exact same problems as him. I changed browser to Firefox 3.0.11 a couple of months ago and hence downloaded the Flash plugin for Firefox. I noticed the issue straight away in Youtube, but not on other sites. As I attributed the problem to Firefox, I then downloaded Opera 9.64 - but experienced the same problem. This led me to believe the issue was the Flash plugin, as both browsers are served by the same Adobe plugin for 'alternative browsers' to IE.
    I then tried IE6 again in youtube and it didn't have the problem on standard view, however the problem was (and still is) occurring in full screen view. I'm nearly 100% sure this problem didn't occur before I downloaded the Flash plugin for Firefox / Opera. Regardless of whether that is the issue, the problem was definitely not happening on my system in IE6 earlier this year.
    As Ben said, my computer is fairly old but well managed and up to date. OS is Windows 2000 SP4, system is AMD Athlon 900 (slot A), 512 Mb RAM, 16Mb Voodoo 3 graphics, m/board MSI MS-6191.
    I've also tried removing the Flash plugin for Firefox/Opera and for IE6 and reinstalling it but had no joy there either. I would try an updated version of IE too but IE6 is the last version compatible with Win 2k.
    Any help appreciated, thanks.
    Matt

  • FRM-40735 when Button Pressed Trigger Raised Unhandled Exception ORA-03113

    Hi all,
    We are using oracle 9.2.0.4 on SUSE 10.When user try to insert record second time they are getting the error
    FRM-40735 when Button Pressed Trigger Raised Unhandled Exception ORA-03113And we are also getting ORa-0600 [12333]-[253]-[1]-[253]
    Please don't tell me that this is an oracle internal error and i have to contact oracle support.
    Actaually earlier we were using Oracle 9.2.0.6 (64 bit)on sun soalris 8 9(64 bit) and now after migrating the same to Oracle 9.2.0.4 to RHEL4 (32 bit).
    And i have also cross checked on the new server oracle 9.2.0.6 (64 bit) on rhel4 (64 bit).
    please suggest me....

    Please don't tell me that this is an oracle internal error and i have to contact oracle support.WHY? But it's the one and only reason! What do you think, how we can solve internal error? Do we have a special utility to demand from you some logs and by uising that utility analyze your database and solve your problem?

  • FRM-40735 WHEN BUTTON PRESSED trigger raised unhandled exception ORA-29282

    Hi All,
    while entering data in EAM forcaste workorder in maintenance workbench am getting this error
    FRM-40735 WHEN BUTTON PRESSED trigger raised unhandled exception ORA-29282
    check google and oracle forums and checked versions of pll and plx (as mentioned in one forum) for the form every thing is fine
    i hav also generated tkprof report but did'nt get enough info required
    my environment
    linux 5.6
    R12.1.3
    on 11.1.0.7
    please do let me know how to attach the print screen and tkprof report
    please help
    zavi

    Hi There,
    Srini:
    the form form name is different from one you mentioned in note
    ORA-29282 In POST-DELETE Trigger In EAMWOMDF Form [ID 1364328.1]
    any how i check the EAM diag option is set to yes,
    sorry i cant upload the screenshots and trace file we cant upload any from company
    here are few details from form-->help--> about
    RDBMS : 11.1.0.7.0
    Oracle Applications : 12.1.3
    Form Application : Enterprise Asset Management
    Form Name : EAMPLNWB
    Form Path : /u02/uat/apps/apps_st/appl/eam/12.0.0/forms/US/EAMPLNWB.fmx
    Form Version : 12.0.78.12010000.28
    Form Last Modified : $Date: 2011/05/17 02:44 $
    Forms PL/SQL
    APPCORE : 12.0.29.12010000.22
    APPDAYPK : 12.0.2.12010000.6
    APPFLDR : 12.0.6.12010000.2
    APPTREE : 12.0.0
    CUSTOM : 12.0.0
    EAMMRMDF : 12.0.27.12010000.4
    EAMOPMDF : 12.0.13.12010000.1
    EAMRSMDF : 12.0.10.12010000.2
    EAMWOMDF : 12.0.77.12010000.25
    FNDAPLT : 12.0.1
    FNDSQF : 12.0.3.12010000.8
    GHR : 12.0.46.12010000.14
    GLOBE : 12.0.76.12010000.10
    GMS : 12.0.51.12010000.8
    IGILUTIL2 : 12.0.32
    IGILUTIL : 12.0.3
    OPM : 12.0.7.12010000.2
    PQH_GEN : 12.0.7
    PSA : 12.0.17
    PSAC : 12.0.5
    PSB : 12.0.2
    Hi Hussain:
    from the note
    Please see (Creating Work Orders with Activity gives PL/SQL: numeric or value error: ORA-06512: at "APPS.EAM_WORKORDER_PKG", line 1431 [ID 822365.1]).
    it says about
    to debug the issue, users has enabled profile EAM: Debug Profile Option needs to be set to Yes at site level.
    Every time when WO API is involved, the following files are generated: createwo.log , updatewo.log.
    where can i find those logs please specify the location
    what i did
    as said by hussain i have manually compiled form and libraries assocaited with that form
    still waiting for reply from user
    got tkprof report
    few lines from that tkprof:
    declare                         
         m_stmt     varchar2(512);               
    begin                         
         m_stmt:='delete     from     sdo_geor_ddl__table$$';          
         EXECUTE     IMMEDIATE     m_stmt;          
         EXCEPTION                    
         WHEN     OTHERS     THEN          
         NULL;                    
    end;                         
    some select statement
    SELECT     MAX(STOCK_LOCATOR_CONTROL_CODE),     MAX(DEFAULT_DEMAND_CLASS),               
         MAX(CALENDAR_CODE),     MAX(CALENDAR_EXCEPTION_SET_ID),               
         NVL(MAX(PROJECT_REFERENCE_ENABLED),2),     NVL(MAX(PROJECT_CONTROL_LEVEL),1),               
         NVL(MAX(PM_COST_COLLECTION_ENABLED),2),     MAX(PRIMARY_COST_METHOD)               
    FROM                         
         MTL_PARAMETERS     WHERE     ORGANIZATION_ID     =     :B1
    insert statement its performing
    insert     into     eam_forecasted_work_orders(     pm_forecast_id,     group_id,                                                       
         pm_schedule_id,     activity_association_id,     cycle_id,     seq_id,                                                       
         scheduled_start_date,     scheduled_completion_date,     action_type,                                                            
         wip_entity_id,     process_flag,     wo_status,     created_by,     creation_date,                                                  
         last_update_date,     last_updated_by,     pm_base_meter_reading     ,                                                       
         ORGANIZATION_ID     )                                                                 
    values                                                                           
    (     :1,     :2,     :3,     :4,     :5,     :6,     :7,     :8,     :9,     :10,     :11,     :12,     :13,     sysdate,     sysdate,
         :14,:15,:16     )                                                                 
    please add a line through your vission
    cheers
    Zavi

  • Wait For A Button Press

    Hey, I am currently creating a game and need to know how to wait for a certain button to be pressed. A popup message comes up that tells the user to press a button, then I need to wait for the button to be pressed. Then once the button is pressed, I want another message to come up. The problem is, I have no idea how to wait for a button press after the first message comes up. Instead it just displays the first message, then the second directly after.
    Thanks

    So you have a button that is always present. Normally clicking the button does nothing. But sometimes a message shows up, in which case if the user clicks the button, something happens. Right?
    UI principles aside (it's bad form to display a button that does nothing), this is pretty simple.
    Create a field to track whether the button does anything. For example:
    private boolean buttonActive = false;In your action listener for that button, first check the value:
    public void actionPerformed(ActionEvent e) {
        if (buttonActive) {
            // do your thing
    }If the buttonActive is true, it does something, otherwise it does nothing.
    After you display the message, set buttonActive to true. When you want the button to become a brick again, set it to false.

Maybe you are looking for