Jump to content

Recommended Posts

Posted

I have a re-sizable GUI with GRID like input boxes.  Each box will only contain 2-3 insertable characters. There are few features i would like to add, just a newbie and can't figure out it. 

When i resize the gui, the input boxes width expands to size of the GUI, but the Height remains the same, is there anyway to increase to Height when the gui is resized?

Also, would like to add a "reset" button at the bottom to Clear any text that has been typed into all the fields. Any help or pointers would be greatly appreciated. Thank you

#include <GUIConstants.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("DG", 132, 125, -1, -1, $WS_SIZEBOX + $WS_EX_LAYERED)
    GUISetState(@SW_SHOW, $hGUI)
    WinSetTrans($hGUI, "", 170)

GUICtrlCreateInput("", 0, 0, 33, 25)
GUICtrlCreateInput("", 33, 0, 34, 25)
GUICtrlCreateInput("", 67, 0, 34, 25)
GUICtrlCreateInput("", 100, 0, 34, 25)

GUICtrlCreateInput("", 0, 25, 33, 25)
GUICtrlCreateInput("", 33, 25, 34, 25)
GUICtrlCreateInput("", 67, 25, 34, 25)
GUICtrlCreateInput("", 100, 25, 34, 25)

GUICtrlCreateInput("", 0, 50, 33, 25)
GUICtrlCreateInput("", 33, 50, 34, 25)
GUICtrlCreateInput("", 67, 50, 34, 25)
GUICtrlCreateInput("", 100, 50, 34, 25)

GUICtrlCreateInput("", 0, 75, 33, 25)
GUICtrlCreateInput("", 33, 75, 34, 25)
GUICtrlCreateInput("", 67, 75, 34, 25)
GUICtrlCreateInput("", 100, 75, 34, 25)




    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($hGUI)
EndFunc   ;==>Example

 

Posted

Here :

#include <GUIConstants.au3>

Example()

Func Example()
  Local $hGUI = GUICreate("DG", 132, 150, -1, -1, $WS_SIZEBOX + $WS_EX_LAYERED)
  WinSetTrans($hGUI, "", 170)
  Local $aInput[4][4]
  For $i = 0 to 3
    For $j = 0 to 3
      $aInput[$i][$j] = GUICtrlCreateInput("", round($j*33.3), $i*25, 33+($j?1:0), 25)
      GUICtrlSetResizing (-1, $GUI_DOCKAUTO)
    Next
  Next

  Local $idClear = GUICtrlCreateButton ("Clear",50,101,32,25)
  GUICtrlSetResizing (-1, $GUI_DOCKAUTO)

  GUISetState()

  While True
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE
        ExitLoop
      Case $idClear
        For $i = 0 to 3
          For $j = 0 to 3
            GUICtrlSetData ($aInput[$i][$j],"")
          Next
        Next
    EndSwitch
  WEnd
EndFunc   ;==>Example

 

Posted

An alternative way, to use only if explicit names are needed for the inputs

#include <GUIConstants.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("DG", 132, 125, -1, -1, $WS_SIZEBOX + $WS_EX_LAYERED)
    GUISetState(@SW_SHOW, $hGUI)
    WinSetTrans($hGUI, "", 170)

$input1 = GUICtrlCreateInput("", 0, 0, 33, 25)
GUICtrlCreateInput("", 33, 0, 34, 25)
GUICtrlCreateInput("", 67, 0, 34, 25)
GUICtrlCreateInput("", 100, 0, 34, 25)

GUICtrlCreateInput("", 0, 25, 33, 25)
GUICtrlCreateInput("", 33, 25, 34, 25)
GUICtrlCreateInput("", 67, 25, 34, 25)
GUICtrlCreateInput("", 100, 25, 34, 25)

GUICtrlCreateInput("", 0, 50, 33, 25)
GUICtrlCreateInput("", 33, 50, 34, 25)
GUICtrlCreateInput("", 67, 50, 34, 25)
GUICtrlCreateInput("", 100, 50, 34, 25)

GUICtrlCreateInput("", 0, 75, 33, 25)
GUICtrlCreateInput("", 33, 75, 34, 25)
GUICtrlCreateInput("", 67, 75, 34, 25)
$input16 = GUICtrlCreateInput("", 100, 75, 34, 25)

For $i = $input1 To $input16
    GUICtrlSetResizing ($i, $GUI_DOCKAUTO)
Next

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($hGUI)
EndFunc   ;==>Example

 

Posted

Thank you all very much! It's working just as i needed, and learned some new things in the process. Thanks for the example codes I really appreciate it!

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...