Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Feb 2009
    Posts
    1,285

    Buttons: Do action(s) while long pressing

    Hi all!
    As I wrote in the title of this thread, I need help with buttons.
    By default, the actions written on the "OnClick" event are done just when user leaves the left click (or right click). For me, it could be usefully doing reapeatly the actions by long pressing the button.

    Is there anything can help me doing this?
    Tankyou,

    p.s. Sorry for my bad english. If anyone can't understand what I wrote just tell me.

    Bye!

  2. #2
    Join Date
    Aug 2003
    Posts
    2,427
    I can't think how to do this purely with AMS but I'm sure you could get pretty close, I'd just use a flash button as per this example.

  3. #3
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    I think he was talking about something more like this.

    I may be wrong.
    Attached Files

  4. #4
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by mwreyf1 View Post
    I think he was talking about something more like this.

    I may be wrong.
    I was going on -

    doing reapeatly the actions by long pressing the button.

  5. #5
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    Oh yes, I see.

    My bad...

    Should have read slower.

  6. #6
    Join Date
    Feb 2009
    Posts
    1,285
    This is what I need, just, I can't (I don't know how to) modify the code to respond when the left mouse button is down. I've tried but I really can't.
    Can you do it for me, please?

    Tankyou
    Bye!

  7. #7
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    Which one do you need modified?

    longedge's solution or mine?

    Don't think longedge's solution will work with mouse button down.
    Last edited by mwreyf1; 06-01-2009 at 03:08 PM.

  8. #8
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by mwreyf1 View Post
    Which one do you need modified?

    longedge's solution or mine?

    Don't think longedge's solution will work with mouse button down.
    I was wondering as well but since the example I posted already does what I think is being asked for I don't know what I can add. The button detects as long as the mouse button is kept pressed and then detects when it is released. I just used it to change a label but the code could be anything at all.

    As I've said in the past, flash buttons suit me because they allow for more states than standard AMS buttons - roll over, roll out, press, release, release outside, drag over and drag out (although I only ever use the first four).
    Last edited by longedge; 06-01-2009 at 03:46 PM.

  9. #9
    Join Date
    May 2006
    Posts
    1,443
    some times searching gives you good results

    also this is implemented in various examples in the forum

    http://www.indigorose.com/forums/sho...light=hit+test

  10. #10
    Join Date
    Feb 2009
    Posts
    1,285
    Tankyou for help, isn't what I need at all, but I'll try to build the code my self.

    Bye!

  11. #11
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by T3STY View Post
    Tankyou for help, isn't what I need at all, but I'll try to build the code my self.

    Bye!
    OK but just satisfy my curiosity please. When you said "This is what I need, just, I can't (I don't know how to) modify the code to respond when the left mouse button is down. I've tried but I really can't.
    Can you do it for me, please?"
    - who was it addressed to?

  12. #12
    Join Date
    Apr 2009
    Posts
    277
    Tankyou for help, isn't what I need at all, but I'll try to build the code my self.
    man are you trippin?, thats exactly what you need, simply test for a mouse down inside the hittest area and use a timer to repeat the actions


    heres a simplified version useiing reteset's timer object plugin (to save the page timer)

    Page OnShow
    Code:
    nCounter=0
    Page OnMouseButton
    Code:
    if IsInRectEX1("Button1") then
    	if e_Type == LEFT_BUTTON_DOWN then
    		TimerID = Timer.StartTimer("Plugin1", 100, 100);
    	elseif e_Type == LEFT_BUTTON_UP then
    		Timer.StopTimer("Plugin1", TimerID);
    	end
    end
    Timer Object (OnTimer)
    Code:
    if e_TimerId == 100 then
    	Label.SetText("Label1", "Counter: ("..nCounter..")");
    	nCounter=nCounter+1
    end
    and place this function in the global area
    Code:
    function IsInRectEX1(strObject)
    	mObjType = Page.GetObjectType(strObject)
    	if mObjType == OBJECT_BUTTON then
    		m_tblPos = Button.GetPos(strObject)	
    		m_tblSize = Button.GetSize(strObject)
    	elseif mObjType == OBJECT_FLASH then
    		m_tblPos = Flash.GetPos(strObject)
    		m_tblSize = Flash.GetSize(strObject)
    	elseif mObjType == OBJECT_HOTSPOT then
    		m_tblPos = Hotspot.GetPos(strObject)
    		m_tblSize = Hotspot.GetSize(strObject)
    	elseif mObjType == OBJECT_IMAGE then
    		m_tblPos = Image.GetPos(strObject)
    		m_tblSize = Image.GetSize(strObject)
    	elseif mObjType == OBJECT_INPUT then
    		m_tblPos = Input.GetPos(strObject)
    		m_tblSize = Input.GetSize(strObject)
    	elseif mObjType == OBJECT_LABEL then
    		m_tblPos = Label.GetPos(strObject)
    		m_tblSize = Label.GetSize(strObject)
    	elseif mObjType == OBJECT_LISTBOX then
    		m_tblPos = ListBox.GetPos(strObject)
    		m_tblSize = ListBox.GetSize(strObject)
    	elseif mObjType == OBJECT_PARAGRAPH then
    		m_tblPos = Paragraph.GetPos(strObject)
    		m_tblSize = Paragraph.GetSize(strObject)
    	elseif mObjType == OBJECT_PLUGIN then
    		m_tblPos = Plugin.GetPos(strObject)
    		m_tblSize = Plugin.GetSize(strObject)
    	elseif mObjType == OBJECT_VIDEO then
    		m_tblPos = Video.GetPos(strObject)
    		m_tblSize = Video.GetSize(strObject)
    	elseif mObjType == OBJECT_WEB then
    		m_tblPos = Web.GetPos(strObject)
    		m_tblSize = Web.GetSize(strObject)
    	elseif mObjType == OBJECT_RADIOBUTTON then
    		m_tblPos = RadioButton.GetPos(strObject)
    		m_tblSize = RadioButton.GetSize(strObject)
    	elseif mObjType == OBJECT_RICHTEXT then
    		m_tblPos = RichText.GetPos(strObject)
    		m_tblSize = RichText.GetSize(strObject)
    	elseif mObjType == OBJECT_CHECKBOX then
    		m_tblPos = CheckBox.GetPos(strObject)
    		m_tblSize = CheckBox.GetSize(strObject)
    	elseif mObjType == OBJECT_SLIDESHOW then
    		m_tblPos = SlideShow.GetPos(strObject)
    		m_tblSize = SlideShow.GetSize(strObject)
    	elseif mObjType == OBJECT_GRID then
    		m_tblPos = Grid.GetPos(strObject)
    		m_tblSize = Grid.GetSize(strObject)
    	end
    	local tMouse=System.GetMousePosition(true);
    	local m_nX=tMouse.X
    	local m_nY=tMouse.Y
    	local bReturn = false;
    	if (m_nX >= m_tblPos.X) and (m_nX <= m_tblPos.X + m_tblSize.Width) then
    		if (m_nY >= m_tblPos.Y) and (m_nY <= m_tblPos.Y + m_tblSize.Height) then
    			bReturn = true;
    		end
    	end
    	return bReturn;
    end
    or view the example
    Attached Files

  13. #13
    Join Date
    Feb 2009
    Posts
    1,285
    OK MicroByte, that's what I was searching for.
    I hope you're not nervous beacuse, by reading your post, seems you are.

    However, thanks for help. Now I'm going to continue building my application.
    Bye!
    Last edited by T3STY; 06-03-2009 at 04:32 AM.

Similar Threads

  1. Menu bar actions>> buttons actions
    By FoxLeader in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 01-09-2007, 02:27 PM
  2. TrueUpdate 2.0 Update (v2.0.6.0) Released
    By Brett in forum TrueUpdate 2.0
    Replies: 0
    Last Post: 10-31-2006, 01:10 PM
  3. SWF Buttons / Actions
    By Florian Loeffler in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 04-28-2004, 12:26 AM
  4. Actions on buttons
    By praveen_v in forum Setup Factory 6.0
    Replies: 1
    Last Post: 12-11-2002, 04:00 PM

Posting Permissions

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