devilyn Posted November 9, 2010 Share Posted November 9, 2010 Is there a way to align label to bottom? like $SS_Center? thanks in advance. Link to comment Share on other sites More sharing options...
GEOSoft Posted November 9, 2010 Share Posted November 9, 2010 No style that I'm aware of to align it to the bottom but you can align the text to the vertical center with $SS_CENTERIMAGE. If you need it lower than that you will have to reposition the label a bit. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 9, 2010 Moderators Share Posted November 9, 2010 devilyn,Not that I know of, but if you use the StringSize UDF in my sig, you can work out how big the text is and then position a second label at the bottom of the first - like this: #include <GUIConstantsEx.au3> #include <StringSize.au3> $sText = "I am at the bottom" $hGUI = GUICreate("Test", 500, 500) ; Create the label as big as you want $hLabel_1 = GUICtrlCreateLabel("", 10, 10, 480, 480) GUICtrlSetBkColor(-1, 0xFF0000) ; Get the size of the text $aSize = _StringSize($sText) ; Calculate the position of the second label $iLabel_X = (480 - $aSize[2]) / 2 $iLabel_Y = 490 - $aSize[3] ; and create it $hLabel_2 = GUICtrlCreateLabel($sText, $iLabel_X, $iLabel_Y, $aSize[2], $aSize[3]) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndJust give the labels the same background colour or make the top one transparent. All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
martin Posted November 9, 2010 Share Posted November 9, 2010 Also, don't forget that you can add @CR like this $g = GUICreate("") $lb = GUICtrlCreateLabel(@crlf & @crlf & @crlf & @crlf & @crlf & @crlf & " text at the bottom of the label",20,20,200,95) GUICtrlSetBkColor(-1,0xff0000) GUISetState() sleep(9000) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Malkey Posted November 10, 2010 Share Posted November 10, 2010 Here is an example of a function using ControlGetPos() and ControlMove() to align the bottom of controls. expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Local $hGui, $widthCell, $heightCell, $msg, $Input1, $lab2, $lab3, $lab4, $lab5 $hGui = GUICreate("Bottom Alignment", 400, 200) $widthCell = 80 $Input1 = GUICtrlCreateInput("Column 1" , 10 , 30 , $widthCell) $lab2 = GUICtrlCreateLabel("Column 2" & @CRLF & "Row 2" , 10 + $widthCell , 30 - 20) $lab3 = GUICtrlCreateLabel("Column 3" & @CRLF & "Row 2" & @CRLF & "Row 3" , 10 + $widthCell * 2 , 30 + 20) GUICtrlSetBkColor(-1,0xB0B0B0) $lab4 = GUICtrlCreateLabel("Column 4" & @CRLF & "Row 2" , 10 + $widthCell * 3 , 30) $lab5 = GUICtrlCreateLabel("Column 5" , 10 + $widthCell * 4 , 30 + 70) ;GUICtrlSetBkColor(-1,0xC0C0C0) GUISetState() MsgBox(0, "Before Bottom alignment", "Press OK to continue to bottom align the controls") Local $aAlignCtrls[6] = [$hGui, $Input1, $lab2, $lab3, $lab4, $lab5] _AlignCtrlBottom($aAlignCtrls) ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE ; ========================== _AlignCtrlBottom ============================= ; Description: Will align the bottom of all specified GUI controls to the bottom of the tallest control box. ; Parameter: ; $aAlignCtrls - An array containing $aAlignCtrls[0] as the handle of the GUI (window) in which the controls preside; and, ; $aAlignCtrls[1...n], contains the identifiers (controlIDs) of the controls to be bottom aligned. ; Func _AlignCtrlBottom($aAlignCtrls) Local $aPos, $iMax, $iBottom $aPos = ControlGetPos($aAlignCtrls[0], "", $aAlignCtrls[1]) ; Determine bottom alignment value. For $i = 1 To UBound($aAlignCtrls) - 1 $aPos = ControlGetPos($aAlignCtrls[0], "", $aAlignCtrls[$i]) If $aPos[3] > $iMax Then $iMax = $aPos[3] $iBottom = $aPos[1] + $aPos[3] ; This "Y" value used to align bottom of controls. EndIf Next ; Align controls For $i = 1 To UBound($aAlignCtrls) - 1 $aPos = ControlGetPos($aAlignCtrls[0], "", $aAlignCtrls[$i]) ControlMove($aAlignCtrls[0], "", $aAlignCtrls[$i], $aPos[0], $iBottom - $aPos[3]) Next EndFunc ;==>_AlignCtrlBottom 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