Results 1 to 3 of 3

Thread: Creating a long press button function

  1. #1

    Question Creating a long press button function

    Reworking the GNS530 for FS2020 and want to create a function for the "CLR" button which returns to the default nav page with a long press. Mobiflight already has an event ID to handle the long press, MobiFlight.AS530_CLR_Push_Long, I just need to create a function that detects a long press....thinking probably 2000ms should work.

  2. #2
    Join Date
    Sep 2010
    Location
    Groningen, The Netherlands
    Posts
    84

    Default

    No support for Lvars and certain events yet. Their SDK still doesn't work as it should and there's hardly any documentation. We don't want to go the 'hacky' way. Microsoft/Asobo has to get their act together and put more time in their SDK.

  3. #3

    Default

    Quote Originally Posted by LNRalph View Post
    No support for Lvars and certain events yet. Their SDK still doesn't work as it should and there's hardly any documentation. We don't want to go the 'hacky' way. Microsoft/Asobo has to get their act together and put more time in their SDK.
    Got some help on it. It's just a logic issue, the events are all in place. This works great:

    ----button hold----

    function button_press()
    button_held_timer_id = timer_start(500, 0, button_held)
    end

    function button_held()
    timer_stop(button_held_timer_id) --should already be stopped, but just in case.
    button_hold_active = true
    print("button held!!")
    end

    function instrument_btn_name()
    timer_stop(button_held_timer_id)
    if (button_hold_active) then
    PUT LONG PRESS EVENT CODE HERE
    button_hold_active = false
    else
    PUT CLICK EVENT CODE HERE
    print("button click")
    end
    end

    //button_id = button_add(img_normal,img_pressed,x,y,width,height,press_callback,release_callback)
    button_add(nil, "panel_btn_image.png", PosX, PosY, ImageX, ImageY, button_press, instrument_btn_name)

Similar Threads

  1. Replies: 13
    Last Post: 07-01-2013, 08:35 AM
  2. Lost panel switch, button and knob function
    By Wintersedge in forum FSX
    Replies: 1
    Last Post: 06-13-2012, 09:14 PM
  3. Replies: 2
    Last Post: 05-09-2004, 01:50 PM
  4. What button do you press to check FPS.
    By rtballer33 in forum FS2004
    Replies: 2
    Last Post: 08-01-2003, 08:35 PM
  5. Replies: 4
    Last Post: 02-01-2002, 08:24 PM

Tags for this Thread

Posting Permissions

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