Announcement

Collapse
No announcement yet.

How to resize a inputbox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to resize a inputbox

    Hi guys

    Is possible resize an inputbox ?
    I would like to "make bigger" de input box on click. This would make easier enter data on it.

    After input the data, clicking out of the input box, the size would be reset as original.

    Do you know how to do it?


    Thanks
    Dove

  • #2
    Input.SetSize
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment


    • #3
      I did it.

      I can manage to resize the inputbox but after enter the data, I can´t set default size again.

      Comment


      • #4
        1 way would be to hover the mouse over the input


        try this

        add this function to the global area
        Code:
        -- edited version of worms IsInRect function
        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

        and use something like this to resize your inputs (on mouse move event)
        Code:
        if IsInRectEX1("Input1") then
        	Input.SetSize("Input1", 400, 400);
        else
        	Input.SetSize("Input1", 400, 200);
        end
        Last edited by RizlaUK; 02-01-2009, 11:34 AM.
        Embrace change in your life, you never know, it could all work out for the best

        Comment


        • #5
          Thanks!

          I was worried this morning when I saw this "huge among of lines" but I did not realize the attached .apz

          All clear, Im editing the code right now, but it works (of course it does).

          Thanks Rizla
          Last edited by DoveBirkoff; 07-31-2008, 02:05 PM. Reason: Misspelling

          Comment


          • #6
            yes, sorry i should have explained, that function is a generic function for all objects in AMS

            a function like that for just an input would look like this

            Code:
            -- edited version of worms IsInRect function
            function IsInInputRect(strObject)
            	mObjType = Page.GetObjectType(strObject)
            	if mObjType == OBJECT_INPUT then
            		m_tblPos = Input.GetPos(strObject)
            		m_tblSize = Input.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

            but it pays to keep it generic, for obvious reasons
            Embrace change in your life, you never know, it could all work out for the best

            Comment

            Working...
            X