strate Posted March 22, 2006 Share Posted March 22, 2006 I'm having a problem with my code... like always.... I'm unable to get the longest control to resize. I'll worry about the other controls later. expandcollapse popup#include <GUIConstants.au3> #Include <GuiListView.au3> Dim $List = '', $item[100],$intPrinters = 1,$OldStringlength = 1,$StringNumber = '' GUICreate("Available Printers:",200,250, 0,0) $font="Lucida Console" GUISetFont (9, 400, -1, $font) ;~ $button = GUICtrlCreateButton ("Value?",75,170,70,20) $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery ('SELECT * FROM Win32_Printer') For $objItem In $colItems $String = $objItem.DeviceID & ' on ' & $objItem.PortName $StringLength = Stringlen($String) If $StringLength > $OldStringlength Then $OldStringlength = $StringLength $StringNumber = $intPrinters EndIf If $intPrinters = 1 Then $item[$intPrinters]=GUICtrlCreateCheckbox($String,10,10,400,20) Else $item[$intPrinters]=GUICtrlCreateCheckbox($String,10,$intPrinters*20 - 10,400,20) EndIf $intPrinters = $intPrinters + 1 Next ;~ $Cont_Pos = ControlGetPos("Available Printers:",'',$item[$StringNumber]) ;~ MsgBox(0,'',$StringNumber) $Current_Window_Pos = WinGetPos("Available Printers:",'') $Cont_Pos = ControlGetPos("Available Printers:",'',$item[$StringNumber]) ;~ MsgBox(262144,'Debug line ~46','Selection:' & @lf & '$item[$StringNumber]' & @lf & @lf & 'Return:' & @lf & $item[$StringNumber] & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX ;~ ControlMove("Available Printers:",'',$item[$StringNumber],$Cont_Pos[0],$Cont_Pos[1],$OldStringlength*10) ControlMove("Available Printers:",'',$item[$StringNumber],$Cont_Pos[0],$Cont_Pos[1],800) WinMove("Available Printers:",'',$Current_Window_Pos[0],$Current_Window_Pos[1],$Cont_Pos[2]+30,250) GUISetState() ;~ ControlMove("Available Printers:",'', $item[$StringNumber],$Cont_Pos[0],$Cont_Pos[1], $OldStringlength*5) ;~ ControlMove("Available Printers:",'', $item[$StringNumber],$Cont_Pos[0],$Cont_Pos[1], $OldStringlength*5) ;~ $Cont_Pos = ControlGetPos("Available Printers:",'',$item[$StringNumber]) ;~ MsgBox(0,'',$Cont_Pos[2]) Do $msg = GUIGetMsg () Sleep(25) ;~ Select ;~ Case $msg = $button ;~ MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2) ;~ EndSelect Until $msg = $GUI_EVENT_CLOSE Sorry for everything that is commented out. Not sure but I think I may have found a little error in the help file also. ControlMove:Parameters title The title of the window to move. text The text of the window to move. controlID The control to interact with. See Controls. x X coordinate to move to. y Y coordinate to move to. width [optional]New width of the window. height [optional] New height of the window.Just thinking these might need to say control, no biggie. v3.1.1.114 (beta) INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
strate Posted March 22, 2006 Author Share Posted March 22, 2006 I believe it has to do with this line ControlMove("Available Printers:",'',$item[$StringNumber],$Cont_Pos[0],$Cont_Pos[1],800) regardless of the width parameter, nothing changes. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now