Double Click Grid ??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • RizlaUK
    Indigo Rose Customer
    • May 2006
    • 5552

    Double Click Grid ??

    i know its been suggested, but i need a workaround....now

    any improvised ways to double click a grid, i can get my menu by hotspot like i do with normal listbox.......but how to double click ??

    Any Ideas ??
    Embrace change in your life, you never know, it could all work out for the best
  • holtgrewe
    Indigo Rose Customer
    • Jul 2002
    • 779

    #2
    Rizla
    If you're only doing something on double-click, I suppose you could stack two hotspots. The first click disables the top one.
    The second hotspot will act on the next click, then enable the top one again.

    I guess the timer could be used to reset everything in the event the second click never happened...?

    It's a little 'rough' but it may give you an idea.

    If you're doing something on the single click also, this probably won't work for you...
    Last edited by holtgrewe; 04-03-2008, 03:13 PM.

    Comment

    • Worm
      Indigo Rose Customer
      • Jul 2002
      • 3971

      #3
      Here's my work-around. I like it because it doesn't tie up the timer, and its been very stable for my needs.
      Attached Files

      Comment

      • RizlaUK
        Indigo Rose Customer
        • May 2006
        • 5552

        #4
        yup, thats perfect, thanks worm, seems reliable and easy to add

        @holtgrewe, you was thinking along the same lines i was, it was a little messy and not always reliable,

        also, when you select a cell, you get that tool tip, can that be disabled, i did look at the functions, but theres sooooo many to get to know
        Embrace change in your life, you never know, it could all work out for the best

        Comment

        • holtgrewe
          Indigo Rose Customer
          • Jul 2002
          • 779

          #5
          @worm - That one's going in the ol' tool box. I'm sure I'll be using that somewhere down the road.:yes

          Comment

          • RizlaUK
            Indigo Rose Customer
            • May 2006
            • 5552

            #6
            lol, exactly what i tought, stright in the scriplets folder (most of which contain functions written by worm, lol)
            Embrace change in your life, you never know, it could all work out for the best

            Comment

            • Dermot
              Indigo Rose Customer
              • Apr 2004
              • 1791

              #7
              I was just thinking about how to do this today. I had a customer moaning about not being able to double-click a row to open a record instead of selecting a row and clicking a button. This is perfect, thanks.

              Of course this event should still be added to the grid object.
              Dermot

              I am so out of here :yes

              Comment

              • Intrigued
                Indigo Rose Customer
                • Dec 2003
                • 6138

                #8
                Nice Worm. I mirrored this project on amsuser.com, here:

                Intrigued

                Comment

                • RizlaUK
                  Indigo Rose Customer
                  • May 2006
                  • 5552

                  #9
                  yeah i agree, i would have tought a double click event was starndard in this sort of object, but still, the work-a-round works fine with "Grid.SetToolTipsEnabled(false)", else it all looks kinda funky and causes a delay coz the tooltip gets in the way of the 2nd click, or maybe i could disable the tooltip while the mouse is down....that sounds better


                  also, the "IsInRect" function is one iv often used as supporting other functions but never really took much notice of it till now, very handy and could save a lot of timer code :yes
                  Embrace change in your life, you never know, it could all work out for the best

                  Comment

                  • Dermot
                    Indigo Rose Customer
                    • Apr 2004
                    • 1791

                    #10
                    I just implemented this in one of my apps and it works awesome. Actually it is the Datagrid because it is too much work right now to switch to the Grid, but it works just the same.

                    I agree, a double-click event should be standard for this kind of object.
                    Dermot

                    I am so out of here :yes

                    Comment

                    • bule
                      Indigo Rose Customer
                      • May 2005
                      • 1116

                      #11
                      Here's my edit of the approach:

                      Code:
                      GridX = {}
                      GridX.Border = 2
                      GridX.HeaderHeight = 21
                      GridX.DoubleClickSpeed = 280
                      GridX.CurLastTime = 0
                      function GridX.IsInRect(m_nX, m_nY, m_tblPos, m_tblSize)
                      	if (m_nX >= m_tblPos.X + GridX.Border) and 
                      		(m_nX <= m_tblPos.X + m_tblSize.Width - GridX.Border) and
                      		(m_nY >= m_tblPos.Y + GridX.HeaderHeight + GridX.Border) and 
                      		(m_nY <= m_tblPos.Y + m_tblSize.Height - GridX.Border) then
                      		return true
                      	else	
                      		return false
                      	end
                      end
                      Code:
                      if GridX.IsInRect(e_X, e_Y, Grid.GetPos("Grid1"), Grid.GetSize("Grid1")) then
                      	if e_Type == LEFT_BUTTON_UP then
                      		local nCurTime =  DLL.CallFunction(_SystemFolder .. "\\winmm.dll", "timeGetTime", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
                      		if nCurTime - GridX.CurLastTime <= GridX.DoubleClickSpeed then
                      			-- double-click
                      		end
                      		GridX.CurLastTime = nCurTime
                      	end
                      	if e_Type == RIGHT_BUTTON_UP then
                      		-- right-click
                      	end
                      end
                      It takes care of the grid border (that ugly thing you have to mask out)
                      and makes sure that the header is ignored for the clicks.

                      Never know what life is gonna throw at you. ZubTech

                      Comment

                      • RizlaUK
                        Indigo Rose Customer
                        • May 2006
                        • 5552

                        #12
                        nice going blue, thats better than my way, i put a hotspot over internal grid area and only fired the double click if "IsInRect" returned true for the hotspot, your way certanly is better :yes
                        Embrace change in your life, you never know, it could all work out for the best

                        Comment

                        Working...
                        X