Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/12/2016 in Posts

  1. Melba23

    Forever Scrolling GUIs

    toot, Welcome to the AutoIt forums. I would suggest using the other of my Scrollbar UDFs like this: #include <Array.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <ColorConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GUIScrollbars_Ex.au3> #comments-start Versioning and future development thoughts ------------------------------------------------------------------------------------------------------------------- PMDB Written by Christopher O'leary - 11/11/2016 Updates : Version 1.0.0.0 11/11/2016 - Initial version Future Updates.... This application is designed to allow the setup and management of customers and their projects ------------------------------------------------------------------------------------------------------------------- #comments-end Global $i, $k $i = 0 ; Array Index $k = 1 ; Array Size Global $iEventError = 0 ; to be checked to know if com error occurs. Must be reset after handling. Global $userID, $userInitials, $userName, $userGroup, $userCustomer, $userProject, $userNotifications, $userStartupReport, $userEmail, $userLastLogin, $userRegistration ;Declares global user parameters Global $lstObject, $lstAuth, $reRegister, $guiCustomerCHILD Global $inpCustomerID[$k], $inpCustomer[$k], $imgLogo[$k], $btnAddLogo[$k], $btnAddCustomer[$k], $btnProjectView[$k], $NewLinePos, $BeginPos, $PlusTop, $InstanceCounter ;Declares dynamic controls $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler Opt("GUIDataSeparatorChar", ",") LoadCustomerList() Func LoadCustomerList() #REGION ; GUI CREATION ;-------------------------------------------------------------------------- ;Creates the Customer main GUI ;-------------------------------------------------------------------------- $guiCustomerMAIN = GUICreate("PMDB Customer",500, 600,-1,-1) ;W,H,L,T GUISetFont(13) GUICtrlCreateLabel("ID", 10, 10, 50, 20, $SS_CENTER) ;L,T,W,H GUICtrlCreateLabel("Customer", 70, 10, 200, 20) ;L,T,W,H GUISetFont(11) $btnNewLine = GUICtrlCreateButton("Add Customer", 340, 10, 140, 30) $btnExit = GUICtrlCreateButton("Exit", 340, 550, 140, 40) ;L,T,W,H ControlFocus("PMDB Customer", "", $btnExit) GUISetState(@SW_SHOW, $guiCustomerMAIN) ; Display the main GUI ;-------------------------------------------------------------------------- ;Creates the Customer child GUI ;-------------------------------------------------------------------------- $BeginPos = 0 ; Startposition of the controls $NewLinePos = 64 $PlusTop = 30 ; Moving distance for the controls $guiCustomerCHILD = GUICreate("", 500, 490, 0, 50, $WS_CHILD, -1, $guiCustomerMAIN) ;W,H,L,T GUISetFont(11) ; Create the 1st line of controls and write every single control in each array at index 0 $inpCustomerID[$i] = GUICtrlCreateInput("", 10, 0, 50, 20, $ES_CENTER) ;L,T,W,H GUICtrlSetState($inpCustomerID[$i], $GUI_DISABLE) $inpCustomer[$i] = GUICtrlCreateInput("", 70, 0, 200, 20) ;L,T,W,H $imgLogo[$i] = GUICtrlCreateInput("", 280, 0, 50, 20) ;L,T,W,H $btnProjectView[$i] = GUICtrlCreateButton("View Project", 390, 0, 90, 20) ;L,T,W,H ;$btnAddCustomer[$i] = GUICtrlCreateButton("Save", 384, $BeginPos, 41, 20) ;L,T,W,H ;$aRet = _GUIScrollbars_Size(0, 490, 500, 490) ;L,T,W,H GUISetState(@SW_SHOW, $guiCustomerCHILD) ; Display the child GUI _WinAPI_SetParent($guiCustomerCHILD, $guiCustomerMAIN) ;DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($guiCustomerMAIN), "hwnd", WinGetHandle($guiCustomerCHILD)) ;-------------------------------------------------------------------------- ;Sets up the scroll bars ;-------------------------------------------------------------------------- ; Not needed now ;-------------------------------------------------------------------------- ;Displays the GUI and sets the button functions ;-------------------------------------------------------------------------- #EndRegion $InstanceCounter = 1 ; Counter to count the amount of renderinstances needed to be opened While 1 $msg = GUIGetMsg() Select Case $msg = $btnExit Exit Case $msg = $btnNewLine AddLine() Case $msg > 0 For $iIndex = 0 To UBound($btnProjectView) - 1 If $btnProjectView[$iIndex] = $msg Then ;MsgBox(0, "", "You clicked one of the choose buttons") GUICtrlSetState($inpCustomer[$iIndex], $GUI_DISABLE) GUICtrlSetState($btnAddCustomer[$iIndex], $GUI_DISABLE) GUICtrlSetState($inpCustomerID[$iIndex], $GUI_DISABLE) GUICtrlSetState($imgLogo[$iIndex], $GUI_DISABLE) GUICtrlSetState($btnProjectView[$iIndex], $GUI_DISABLE) ContinueLoop Endif Next For $iIndex = 0 To UBound($btnAddCustomer) - 1 If $btnAddCustomer[$iIndex] = $msg Then ;MsgBox(0, "", "You clicked one of the open buttons") MsgBox(0, "", GUICtrlRead($inpCustomer[$iIndex])) ContinueLoop Endif Next EndSelect WEnd EndFunc Func AddLine() GUISetFont(11) _GUIScrollBars_SetScrollInfoPos($guiCustomerCHILD, $SB_VERT, 0) ; Push NewLineButton down $NewLinePos = $NewLinePos + $PlusTop ;GUICtrlSetPos($NewLineButton, 80, $NewLinePos) $InstanceCounter = $InstanceCounter + 1 ; Count InstanceCounter up $BeginPos = $BeginPos + $PlusTop ; Update the top positions of the controls $i = $i + 1 ; Count index variable up $k = $k + 1 ; Count array size up ; Resize the array / get more room in each array ReDim $inpCustomer[$k] ReDim $btnAddCustomer[$k] ReDim $inpCustomerID[$k] ReDim $imgLogo[$k] ReDim $btnProjectView[$k] ; Amend control posn if scrollbars used $iChild_Height = $k * $PlusTop $iAdjust = 0 If $iChild_Height > 520 Then $iAdjust = -10 EndIf ; Create a new line of controls and store them in the specific array $inpCustomerID[$i] = GUICtrlCreateInput("", 10, $BeginPos, 50, 20, $ES_CENTER) GUICtrlSetState($inpCustomerID[$i], $GUI_DISABLE) $inpCustomer[$i] = GUICtrlCreateInput("", 70 + $iAdjust, $BeginPos, 200, 20) $imgLogo[$i] = GUICtrlCreateInput("", 280 + $iAdjust, $BeginPos, 50, 20) $btnProjectView[$i] = GUICtrlCreateButton("View Project", 390 + (1.5 * $iAdjust), $BeginPos, 90, 20) ; Generate scrollbars If $iChild_Height > 490 Then _GUIScrollbars_Generate($guiCustomerCHILD, 0, $iChild_Height) EndIf EndFunc Please ask if you have any questions. M23
    1 point
  2. mikell

    search value in text file

    Totally allowed of course, please take it easy kneze, Totally different question. This deserves a new thread - and BTW you could first try something by yourself Hint : StringSplit
    1 point
  3. I think I have solution to Q1. But I'm not able to find it quickly .
    1 point
  4. 1 point
  5. nikolas, GuiCtrlSetData takes a simple variable (not an array). Try it like this... #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Excel.au3> #include <Array.au3> Local $oExcel = _Excel_open(false,false,true,true,false) ;$sWorkbook = "C:\Users\protos\Desktop\nikolas\GROUP 2016_123.123.xlsx" $sWorkbook = @scriptdir & "\test.xls" $oWorkbook = _Excel_BookOpen($oExcel,$sWorkbook,False,False,Default,Default,Default) $aResult = _Excel_RangeRead($oWorkbook,"FO",$oWorkbook.ActiveSheet.Usedrange.Columns("A:A"),1,False) _arraydisplay($aResult) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 648, 503) $Combo1 = GUICtrlCreateCombo("", 88, 40, 220, 250) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($Combo1,_arraytostring($aResult)) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd This is one of many ways to populate a combo box. You should also do some error checking after function calls. Test spreadsheet test.xls kylomas
    1 point
  6. Update: beta version 0.9 released., with thanks to @LegitStack. After the discussion here I realised that DPI rescaling also affects the canvas size for the readouts this UDF produces. That means that if your GUIs appear 20% bigger, then the bottom and right edges of the display were being clipped commensurately. So I added a simple adjustment to take care of this, shamelessly copied from LegitStack's code in the other thread (thanks!). No other bells and whistles added, I'm afraid; still too busy battling the forces of darkness to keep your planet safe.
    1 point
  7. To move the color you have to move the ItemParam value. ItemParam contains the control ID of the listview item.
    1 point
×
×
  • Create New...