Skitty Posted April 22, 2011 Posted April 22, 2011 I'm trying to create a gui with an inputbox at the right side, how do I create a control that always stays in that position? Problem is that when the script is run at a different screen resolution, the control is way off to the right and out of the screen. I tried using @Desktopwidth / 2 + 800 but it fails when the screen is that of an acer aspire one d250 net-book but works when using a 21" monitor. I also wanted to create a horizontal progress bar but its always in a different position with different screen resolutions. If any one can locate a topic where this has been looked on before? or are there special functions to take care of this?
guinness Posted April 22, 2011 Posted April 22, 2011 Have a look in the Help File for GUICtrlResizing() or some code to replicate the problem with?! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Skitty Posted April 22, 2011 Author Posted April 22, 2011 (edited) Have a look in the Help File for GUICtrlResizing() or some code to replicate the problem with?! that function seem's to be specific to a window with a boarder.Sorry for not mentioning this before but the gui in question is created as so...GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) Edited April 22, 2011 by System238
wakillon Posted April 22, 2011 Posted April 22, 2011 An inputBox always at right side, like this ?#include <WindowsConstants.au3> HotKeySet ( "{ESC}", "_HotKey" ) $_Gui = GUICreate ( "", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST ) $_Width = 250 GUISetState ( ) $answer = InputBox ( "Question", "Where were you born?", "Planet Earth", "", $_Width, 50, @DesktopWidth - $_Width , 0, 0, $_Gui ) While 1 WEnd Func _HotKey ( ) Exit EndFunc ;==> _HotKey ( ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Skitty Posted April 22, 2011 Author Posted April 22, 2011 An inputBox always at right side, like this ? #include <WindowsConstants.au3> HotKeySet ( "{ESC}", "_HotKey" ) $_Gui = GUICreate ( "", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST ) $_Width = 250 GUISetState ( ) $answer = InputBox ( "Question", "Where were you born?", "Planet Earth", "", $_Width, 50, @DesktopWidth - $_Width , 0, 0, $_Gui ) While 1 WEnd Func _HotKey ( ) Exit EndFunc ;==> _HotKey ( ) AW STUPID ME!!! What I meant was a gui input control box, not that input box lol. thanks for the effort though. Xandy 1
bwochinski Posted April 22, 2011 Posted April 22, 2011 Not sure if this is the best way, but I figured you can just use a function that allows you to position controls essentially by % of screen instead of actual pixels. The "scale()" function is pretty much it. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "end") ;modify these 2 variables to test resolutions... Global $winW = @DesktopWidth/1.5 Global $winH = @DesktopHeight/1.5 $win = GUICreate("", $winW, $winH, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) $edit1 = GUICtrlCreateInput("test", scale(800,1), scale(400,2), scale(150,1)) GUISetState(@SW_SHOW) While True Sleep(250) WEnd Func end() Exit EndFunc Func scale($pct, $axis) $pct /= 1000 ;translates screen to a 1000 x 1000 area in any resolution If $axis = 1 Then Return $winW * $pct ElseIf $axis = 2 Then Return $winH * $pct EndIf Return -1 EndFunc
UEZ Posted April 22, 2011 Posted April 22, 2011 (edited) Something like that? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 295, 76, -1, -1, BitOR($WS_POPUP, $WS_THICKFRAME,$WS_TABSTOP), $WS_EX_TOPMOST) $Input = GUICtrlCreateInput("Input", 160, 8, 121, 21) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKHEIGHT) $bExit = GUICtrlCreateButton("Exit", 208, 40, 75, 25) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $bExit Exit EndSwitch WEnd Br, UEZ Edited April 22, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
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