-
Posts
31,242 -
Joined
-
Days Won
313
Reputation Activity
-
Melba23 got a reaction from Xandy in Select Item in Listview
Hobbyist,
Not entirely - there are many ways to solve this particular puzzle. Your solution was very nearly working as required - and probably could have been perfected with a bit of effort - but I preferred a different approach where we limit our actions to events on the specific controls involved rather than using the more general $GUI_EVENT_PRIMARYUP event which might well be fired in other circumstances.
M23
-
Melba23 got a reaction from ioa747 in How to get double click in label?
Melque_Lima,
There is a very useful search function at top-right of the page. A quick search found several solutions.
M23
-
Melba23 got a reaction from argumentum in How to get double click in label?
Melque_Lima,
There is a very useful search function at top-right of the page. A quick search found several solutions.
M23
-
Melba23 got a reaction from pixelsearch in Regexp Replace LF with CRLF if line on has an LF
gruntydatsun,
I have been using this pattern to force @CRLF line endings for some time:
$sText = StringRegExpReplace($sText, "((?<!\x0d)\x0a|\x0d(?!\x0a))", @CRLF) It looks for (@LF not preceded by @CR) or (@CR not followed by @LF) and replaces them with @CRLF.
M23
-
Melba23 got a reaction from CarlD in Extended Message Box - New Version: 16 Feb 24
Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox?
Would you like to have coloured backgrounds and text? To choose the justification and font?
Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen?
What about having user-defined text on as many buttons as you need? And user-defined icons? Or a visible countdown of the timeout?
Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar?
If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you!
[NEW VERSION] 16 Feb 24
Changed: Some additional functionality added to the "TimeOut" parameter of _ExtMsgBox:
- A positive integer sets the EMB timeout as before.
- A negative integer will double the size of the countdown timer if it is used.
- A colon-delimited string (eg: "10:5") will set the normal EMB timeout (first integer) and will also initially disable the EMB buttons for the required period (second integer).
New UDF and examples in the zip.
Older version changes: ChangeLog.txt
As always, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with all my UDFs (which you can find in my sig below) I am trying to prevent the need for any other include files.
The UDF and examples (plus StringSize) in zip format: ExtMsgBox.zip
Courteous comments and constructive criticisms welcome - guess which I prefer!
M23
-
Melba23 got a reaction from Norm73 in Extended Message Box - New Version: 16 Feb 24
Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox?
Would you like to have coloured backgrounds and text? To choose the justification and font?
Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen?
What about having user-defined text on as many buttons as you need? And user-defined icons? Or a visible countdown of the timeout?
Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar?
If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you!
[NEW VERSION] 16 Feb 24
Changed: Some additional functionality added to the "TimeOut" parameter of _ExtMsgBox:
- A positive integer sets the EMB timeout as before.
- A negative integer will double the size of the countdown timer if it is used.
- A colon-delimited string (eg: "10:5") will set the normal EMB timeout (first integer) and will also initially disable the EMB buttons for the required period (second integer).
New UDF and examples in the zip.
Older version changes: ChangeLog.txt
As always, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with all my UDFs (which you can find in my sig below) I am trying to prevent the need for any other include files.
The UDF and examples (plus StringSize) in zip format: ExtMsgBox.zip
Courteous comments and constructive criticisms welcome - guess which I prefer!
M23
-
Melba23 got a reaction from argumentum in Creating a GUI with multiple tabs, each containing different controls in AutoIt
barbarasdecastro,
Welcome to the AutoIt forums.
Could I suggest reading the Tabs tutorial in the Wiki - that explains how to get controls to appear only on the tab you want.
M23
-
Melba23 got a reaction from rot3r in Action on selection in TreeView
Tjalve,
First, let us deal with handles and ControlIDs.
Windows handles are unique identifiers that the OS uses to keep track of everything on the system, such as GUIs and controls, which continually send messages around the system so that everything in the system knows what is going on (which GUI is active, which control has just been actioned, which key was pressed, etc, etc). These messages contain all sorts of data, but essentially explain "which control has just done what".
AutoIt tries to make life simple for you by using ControlIDs to identify its native controls - theses IDs are actually the indIces of an internal array of all controls maintained by AutoIt. So when you look for these ControlIDs in a GUIGetMsg loop you are asking AutoIt to access the Windows message stream and pick put those messages which refer to that control - the OnEvent commands work in a similar manner.
Now to how the script I posted works.
As the UDF functions return handles and not ControlIDs (which as explained above are only returned by AutoIt native functions) we cannot use a GUIGetMsg loop to look for messages, so we have to do it ourselves rather than relying on AutoIt to do it for us. This is where the GUIRegisterMsg command comes into play - it peeks into the Windows message stream and lets us see what is happening. In the script above we are asking to look at WM_NOTIFY messages - a pretty comprehensive set which, amongst many other things, covers selecting items in a TreeView. When a WM_NOTIFY message is detected in the stream AutoIt then runs the allocated function or "handler" where we can examine the message in detail:
We create a data structure to look at the detailed content of the message - this data is stored by Windows and we use one of the message parameters ($lParam) to access it. We then check that this message was indeed sent by the treeview by looking inside the data structure - we can ignore the vast majority of messages which have been sent by other controls. Finally we check if the message deals with a change of the selected item in the treeview - and if it does than we know that we have found the message we were looking for. And there you have it - because the treeview was created by a UDF and not by an internal AutoIt function, we had to recreate what AutoIt does for us "under the hood" and peer into the Windows message stream ourselves to intercept the message telling us that the user had selected another item in the treeview. You can see the same thing happening with tab controls if you read the Tabs tutorial in the Wiki - if you create the tab with the UDF you need to do a lot more work to make it work correctly.
I hope that the above explanation makes you realise how much AutoIt does for you behind the scenes - please ask again if anything is still unclear.
M23
-
Melba23 got a reaction from Decibel in ArrayMultiColSort -New Release 06 April 2019
[New Release] - 06 April 2019
Added: Error-checking for sensible column numbers in the $aSortData array, with an additional error status.
------------------------------------------------------------------------------------------------------------------------
While answering a recent question about sorting a ListView on several columns, I developed this function to sort a 2D array on several columns and I though I might give it a wider audience.
Here is the function:
#include-once ;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; #INCLUDES# ========================================================================================================= #include <Array.au3> ; =============================================================================================================================== ; #INDEX# ======================================================================================================================= ; Title .........: ArrayMultiColSort ; AutoIt Version : v3.3.8.1 or higher ; Language ......: English ; Description ...: Sorts 2D arrays on several columns ; Note ..........: ; Author(s) .....: Melba23 ; Remarks .......: ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _ArrayMultiColSort : Sort 2D arrays on several columns ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#================================================================================================= ; __AMCS_SortChunk : Sorts array section ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArrayMultiColSort ; Description ...: Sort 2D arrays on several columns ; Syntax.........: _ArrayMultiColSort(ByRef $aArray, $aSortData[, $iStart = 0[, $iEnd = 0]]) ; Parameters ....: $aArray - The 2D array to be sorted ; $aSortData - 2D array holding details of the sort format ; Format: [Column to be sorted, Sort order] ; Sort order can be either numeric (0/1 = ascending/descending) or a ordered string of items ; Any elements not matched in string are left unsorted after all sorted elements ; $iStart - Element of array at which sort starts (default = 0) ; $iEnd - Element of array at which sort endd (default = 0 - converted to end of array) ; Requirement(s).: v3.3.8.1 or higher ; Return values .: Success: No error ; Failure: @error set as follows ; @error = 1 with @extended set as follows (all refer to $sIn_Date): ; 1 = Array to be sorted not 2D ; 2 = Sort data array not 2D ; 3 = More data rows in $aSortData than columns in $aArray ; 4 = Start beyond end of array ; 5 = Start beyond End ; @error = 2 with @extended set as follows: ; 1 = Invalid string parameter in $aSortData ; 2 = Invalid sort direction parameter in $aSortData ; 3 = Invalid column index in $aSortData ; Author ........: Melba23 ; Remarks .......: Columns can be sorted in any order ; Example .......; Yes ; =============================================================================================================================== Func _ArrayMultiColSort(ByRef $aArray, $aSortData, $iStart = 0, $iEnd = 0) ; Errorchecking ; 2D array to be sorted If UBound($aArray, 2) = 0 Then Return SetError(1, 1, "") EndIf ; 2D sort data If UBound($aSortData, 2) <> 2 Then Return SetError(1, 2, "") EndIf If UBound($aSortData) > UBound($aArray) Then Return SetError(1, 3) EndIf For $i = 0 To UBound($aSortData) - 1 If $aSortData[$i][0] < 0 Or $aSortData[$i][0] > UBound($aArray, 2) -1 Then Return SetError(2, 3, "") EndIf Next ; Start element If $iStart < 0 Then $iStart = 0 EndIf If $iStart >= UBound($aArray) - 1 Then Return SetError(1, 4, "") EndIf ; End element If $iEnd <= 0 Or $iEnd >= UBound($aArray) - 1 Then $iEnd = UBound($aArray) - 1 EndIf ; Sanity check If $iEnd <= $iStart Then Return SetError(1, 5, "") EndIf Local $iCurrCol, $iChunk_Start, $iMatchCol ; Sort first column __AMCS_SortChunk($aArray, $aSortData, 0, $aSortData[0][0], $iStart, $iEnd) If @error Then Return SetError(2, @extended, "") EndIf ; Now sort within other columns For $iSortData_Row = 1 To UBound($aSortData) - 1 ; Determine column to sort $iCurrCol = $aSortData[$iSortData_Row][0] ; Create arrays to hold data from previous columns Local $aBaseValue[$iSortData_Row] ; Set base values For $i = 0 To $iSortData_Row - 1 $aBaseValue[$i] = $aArray[$iStart][$aSortData[$i][0]] Next ; Set start of this chunk $iChunk_Start = $iStart ; Now work down through array For $iRow = $iStart + 1 To $iEnd ; Match each column For $k = 0 To $iSortData_Row - 1 $iMatchCol = $aSortData[$k][0] ; See if value in each has changed If $aArray[$iRow][$iMatchCol] <> $aBaseValue[$k] Then ; If so and row has advanced If $iChunk_Start < $iRow - 1 Then ; Sort this chunk __AMCS_SortChunk($aArray, $aSortData, $iSortData_Row, $iCurrCol, $iChunk_Start, $iRow - 1) If @error Then Return SetError(2, @extended, "") EndIf EndIf ; Set new base value $aBaseValue[$k] = $aArray[$iRow][$iMatchCol] ; Set new chunk start $iChunk_Start = $iRow EndIf Next Next ; Sort final section If $iChunk_Start < $iRow - 1 Then __AMCS_SortChunk($aArray, $aSortData, $iSortData_Row, $iCurrCol, $iChunk_Start, $iRow - 1) If @error Then Return SetError(2, @extended, "") EndIf EndIf Next EndFunc ;==>_ArrayMultiColSort ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __AMCS_SortChunk ; Description ...: Sorts array section ; Author ........: Melba23 ; Remarks .......: ; =============================================================================================================================== Func __AMCS_SortChunk(ByRef $aArray, $aSortData, $iRow, $iColumn, $iChunkStart, $iChunkEnd) Local $aSortOrder ; Set default sort direction Local $iSortDirn = 1 ; Need to prefix elements? If IsString($aSortData[$iRow][1]) Then ; Split elements $aSortOrder = StringSplit($aSortData[$iRow][1], ",") If @error Then Return SetError(1, 1, "") EndIf ; Add prefix to each element For $i = $iChunkStart To $iChunkEnd For $j = 1 To $aSortOrder[0] If $aArray[$i][$iColumn] = $aSortOrder[$j] Then $aArray[$i][$iColumn] = StringFormat("%02i-", $j) & $aArray[$i][$iColumn] ExitLoop EndIf Next ; Deal with anything that does not match If $j > $aSortOrder[0] Then $aArray[$i][$iColumn] = StringFormat("%02i-", $j) & $aArray[$i][$iColumn] EndIf Next Else Switch $aSortData[$iRow][1] Case 0, 1 ; Set required sort direction if no list If $aSortData[$iRow][1] Then $iSortDirn = -1 Else $iSortDirn = 1 EndIf Case Else Return SetError(1, 2, "") EndSwitch EndIf ; Sort the chunk Local $iSubMax = UBound($aArray, 2) - 1 __ArrayQuickSort2D($aArray, $iSortDirn, $iChunkStart, $iChunkEnd, $iColumn, $iSubMax) ; Remove any prefixes If IsString($aSortData[$iRow][1]) Then For $i = $iChunkStart To $iChunkEnd $aArray[$i][$iColumn] = StringTrimLeft($aArray[$i][$iColumn], 3) Next EndIf EndFunc ;==>__AMCS_SortChunk And here is an example to show it working:
#include "ArrayMultiColSort.au3" #include <String.au3> ; Only used to fill array ; Create and display array Global $aArray[100][4] For $i = 0 To 99 $aArray[$i][0] = _StringRepeat(Chr(Random(65, 68, 1)), 5) $aArray[$i][1] = _StringRepeat(Chr(Random(74, 77, 1)), 5) $aArray[$i][2] = _StringRepeat(Chr(Random(80, 83, 1)), 5) $aArray[$i][3] = _StringRepeat(Chr(Random(87, 90, 1)), 5) Next _ArrayDisplay($aArray, "Unsorted") ; Copy arrays for separate examples below $aArray_1 = $aArray $aArray_2 = $aArray ; This sorts columns in ascending order - probably the most common requirement ; Sort requirement: ; Col 0 = Decending ; Col 1 = Ascending ; Col 2 = Required order of elements (note not alphabetic PQRS nor reverse SRQP) ; Col 3 = Ascending Global $aSortData[][] = [ _ [0, 1], _ [1, 0], _ [2, "SSSSS,QQQQQ,PPPPP,RRRRR"], _ [3, 0]] ; Sort and display array _ArrayMultiColSort($aArray_1, $aSortData) ; Display any errors encountered If @error Then ConsoleWrite("Oops: " & @error & " - " & @extended & @CRLF) _ArrayDisplay($aArray_1, "Sorted in order 0-1-2-3") ; But the UDF can sort columns in any order ; Sort requirement: ; Col 2 = Decending ; Col 0 = Ascending Global $aSortData[][] = [ _ [2, 1], _ [0, 0]] ; Sort and display array _ArrayMultiColSort($aArray_2, $aSortData) ; Display any errors encountered If @error Then ConsoleWrite("Oops: " & @error & " - " & @extended & @CRLF) _ArrayDisplay($aArray_2, "Sorted in order 2-0") And here are both in zip form: ArrayMultiColSort.zip
As usual all comments welcome.
M23
-
Melba23 got a reaction from Decibel in For loop and _ArrayDelete
caramen,
Start from the bottom and work up:
For $i = $iRows To 0 Step -1 That way you never try to access a non-existent row.
M23
-
Melba23 got a reaction from Parsix in Communicating between autoit programs?
Crash,
My personal favourite is this based on some code from Yashied:
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; Based on code from Yashied #include <GUIConstantsEx.au3> Opt("WinTitleMatchMode", 3) Global Const $WM_COPYDATA = 0x004A Global $sThis_Win_Title, $sThat_Win_Title Global $iY, $hInput, $hButton, $hLabel Global $sMsg_To_Send, $sMsg_Rcvd, $sMsg_Set = "" ; Set GUI title If WinExists("First Instance") Then If WinExists("Second Instance") Then Exit $sThis_Win_Title = "Second Instance" $sThat_Win_Title = "First Instance" $iY = 300 Else $sThis_Win_Title = "First Instance" $sThat_Win_Title = "Second Instance" $iY = 100 EndIf ; Create GUI GUICreate($sThis_Win_Title, 400, 150, 100, $iY) $hInput = GUICtrlCreateInput("", 20, 20, 360, 20) $hButton = GUICtrlCreateButton("Send", 160, 60, 80, 30) $hLabel = GUICtrlCreateLabel("", 20, 100, 360, 20) GUIRegisterMsg($WM_COPYDATA, "_WM_COPYDATA") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; Send close message to other window _SendData(WinGetHandle($sThat_Win_Title), "@exit") Exit Case $hButton ; Send message to other window $sMsg_To_Send = GUICtrlRead($hInput) $hWnd = WinGetHandle($sThat_Win_Title) If (Not @error) And ($sMsg_To_Send <> "") Then _SendData($hWnd, $sMsg_To_Send) EndSwitch ; Check messages received If $sMsg_Rcvd = "@exit" Then Exit If $sMsg_Rcvd <> $sMsg_Set Then GUICtrlSetData($hLabel, $sMsg_Rcvd) $sMsg_Set = $sMsg_Rcvd EndIf WEnd Func _SendData($hWnd, $sData) Local $tCOPYDATA, $tMsg $tMsg = DllStructCreate("char[" & StringLen($sData) + 1 & "]") DllStructSetData($tMsg, 1, $sData) $tCOPYDATA = DllStructCreate("dword;dword;ptr") DllStructSetData($tCOPYDATA, 2, StringLen($sData) + 1) DllStructSetData($tCOPYDATA, 3, DllStructGetPtr($tMsg)) $Ret = DllCall("user32.dll", "lparam", "SendMessage", "hwnd", $hWnd, "int", $WM_COPYDATA, "wparam", 0, "lparam", DllStructGetPtr($tCOPYDATA)) If (@error) Or ($Ret[0] = -1) Then Return 0 Return 1 EndFunc ;==>_SendData Func _WM_COPYDATA($hWnd, $msgID, $wParam, $lParam) Local $tCOPYDATA = DllStructCreate("dword;dword;ptr", $lParam) Local $tMsg = DllStructCreate("char[" & DllStructGetData($tCOPYDATA, 2) & "]", DllStructGetData($tCOPYDATA, 3)) $sMsg_Rcvd = DllStructGetData($tMsg, 1) Return 0 EndFunc ;==>_WM_COPYDATA Just compile it and run it twice.
M23
-
Melba23 got a reaction from pixelsearch in How to get double click in label?
Melque_Lima,
There is a very useful search function at top-right of the page. A quick search found several solutions.
M23
-
Melba23 got a reaction from pixelsearch in Need help with _GUICtrlRichEdit_SetEventMask
qwert,
You need to register WM_COMMAND, not WM_NOTIFY - then you get a response whenever the content is changed:
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> $hGui = GUICreate("Drag Drop", 400, 300, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST)) GUISetFont(12, 400, 0, "Arial") $hEdit = _GUICtrlRichEdit_Create($hGui, "", 20, 30, 360, 120, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_SetFont($hEdit, 14, "Arial") _GUICtrlRichEdit_SetEventMask($hEdit, $ENM_CHANGE) GUICtrlCreateLabel("Drop text into above field", 24, 170, 200, 24) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; ConsoleWrite("Close" & @CRLF) _GUICtrlRichEdit_Destroy($hEdit) ; Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) If $lParam = $hEdit And _WinAPI_HiWord($wParam) = $EN_CHANGE Then ConsoleWrite("Edit content changed" & @CRLF) EndIf EndFunc I am sorry that you find the GUIRegisterMsg tutorial in the Wiki less than satisfactory. It was only ever intended as a brief overview - if you want the full explanation of how Windows messaging works, I recommend MSDN, although it is very detailed.
As to the crossover between GUIGetMsg and needing to register the Windows messages directly - look at the Help file pages <GUI Reference - MessageLoop/OnEvent Mode>. You will see that GUIGetMsg and GUI/GUICtrlSetOnEvent only have a limited set of messages to which they will respond, plus the controls created by AutoIt's native functions. Anything over and above that limited set (such as looking for a change in a UDF-created control as here) requires you to intercept the relevant message yourself. To do that you need to look in MSDN (or search the forum for a suitable crib ) and determine which message is sent and how to intercept it - I looked on MSDN and found this page from which I devised the above code.
Does that make it any clearer?
M23
-
Melba23 got a reaction from hudsonhock in combo scrolling
pcjunki,
Use $WS_VSCROLL in place of $CBS_AUTOHSCROLL.
M23
Edit: And I came up with the same answer again!
-
Melba23 got a reaction from hudsonhock in ComboBox Max List Items?
carlosrapa,
Here you go - a bit of an improvement:
#include <GUIConstantsEx.au3> #include <GUIComboBox.au3> $hGUI = GUICreate("Test", 500, 500) ; Create combo empty $cmbBranch = GUICtrlCreateCombo("", 170, 40, 160, 25) ; Now add data GUICtrlSetData(-1, "000 - St. Louis/HQ|002 - East Peoria|003 - Sikeston|004 - Decatur|005 - Columbia|006 - LaSalle|008 - Mt. Vernon|009 - Hannibal|011 - CAT/East Peoria|012 - CAT/Mossville|014 - CAT/Joliet|016 - CAT/Aurora|017 - CAT/Decatur|031 - Memphis|033 - Tupelo|034 - Jackson|035 - Jonesboro|037 - Little Rock|038 - Springdale|039 - Ft. Smith|040 - Kansas City|041 - Springfield|042 - Joplin|043 - Wichita|044 - St. Joseph|060 - Indianapolis|061 - Ft. Wayne|062 - Lafayette|063 - Muncie|065 - Terre Haute|069 - Columbus|Feitek|Global") ; Now set the edit text - this way it is not one of the possible selections _GUICtrlComboBox_SetEditText($cmbBranch, "Please Select Your Branch") ; And now limit the number of items to show to 15 GUICtrlSendMsg($cmbBranch, $CB_SETMINVISIBLE, 15, 0) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndNote that $CB_SETMINVISIBLE actually sets the MAX visible - blame Bill Gates, not me!
Please ask if you have any questions.
M23
-
Melba23 reacted to water in GUIDelete()
When you learn to ride a bike, you don't ask your parents every 100 metres whether you're doing it right.
As long as you don't fall, you're doing it right.
It's the same with programming.
If it works, then you've done a lot of things right. Maybe not efficiently or according to all the rules of programming, but it works.
You've been working with AutoIt long enough that you should have this confidence in your own abilities and not have to ask after every 5 lines of code.
Have more confidence! If it works, then it's good. If you get wrong results or error messages, that's the time to ask.
Just my 2 cents worth!
Written with the help of DeepL.com translator
-
Melba23 got a reaction from TomTheGeek in Win11 Classic Start
TomTheGeek,
The compiled script in the OP has been removed again. Please do not put it back a third time.
M23
-
-
Melba23 got a reaction from hudsonhock in Show Password box
SeverMessage,
There certainly is an easier way:
#include <GUIConstantsEx.au3> #include <EditConstants.au3> Global $PassStart = IniRead("Config.ini", "Config", "Password", "Default Value") $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $cCheck = GUICtrlCreateCheckbox("Show Password", 10, 50, 150, 20) GUICtrlSetData($cInput, $PassStart) GUISetState() ;Retrieve the ASCII value of the default password char $sDefaultPassChar = GUICtrlSendMsg($cInput, $EM_GETPASSWORDCHAR, 0, 0) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCheck If GUICtrlRead($cCheck) = $GUI_CHECKED Then GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSetData($cCheck, "Show Password") Else GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, $sDefaultPassChar, 0) GUICtrlSetData($cCheck, "Hide Password") EndIf GUICtrlSetState($cInput, $GUI_FOCUS) EndSwitch WEndPlease ask if you have any questions.
M23
-
Melba23 got a reaction from WarMan in Reverse _ArrayToString - (Moved)
Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:
Moderation Team
-
Melba23 got a reaction from mr-es335 in Launch a "root" Menubar item
mr-es335,
A number of solutions in this thread:
M23
-
Melba23 got a reaction from ioa747 in Launch a "root" Menubar item
mr-es335,
A number of solutions in this thread:
M23
-
Melba23 got a reaction from rot3r in Button doesnt work over image
Brentp,
If I had a pound for every time I have answered this I would be considerably richer!
From the Help file:
"If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control [...]: GuiCtrlSetState(-1,$GUI_DISABLE)."
Now you should find it all works as you want:
#include <GUIConstantsEx.au3> $Form1_1 = GUICreate("Selector", 402, 273, 205, 142) $Pic1 = GUICtrlCreatePic("BACKGROUND.BMP", 0, 0, 401, 265) GUICtrlSetState(-1, $GUI_DISABLE) $Button1 = GUICtrlCreateButton("Button 1", 95, 112, 97, 25) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Button2 = GUICtrlCreateButton("Button 2", 95, 148, 97, 25) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Button3 = GUICtrlCreateButton("Button 3", 95, 183, 97, 25) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Button4 = GUICtrlCreateButton("Button 4", 300, 142, 67, 25) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = -3 Then Exit WEndAll clear?
M23
-
Melba23 got a reaction from pixelsearch in New MVPs
I am sure all members will wish to join me in welcoming our new MVPs: argumentum and gianni.
It has been a while since the last promotions, but it goes to show that helping out around here does get noticed!
M23
-
Melba23 got a reaction from Trong in GUIListViewEx - New Version 11Dec 24
[New VERSION] - 11 Dec 24
Added: New function _GUIListViewEx_EditProcessActive which returns the handle of the ListView concerned if an element is being edited. Usage scenario: prevent HotKeys from working when editing is underway.
Fixed: A couple of bugs with columns: added columns were automatically sortable; dragging columns meant editing pop-up could appear in wrong place. Thanks to ValentinM for the reports.
New UDF in the zip below.
--------------------------------------------------------------------------------------
Note: This is a new recoded and expanded version of my earlier UDF of the same name. If you move to this new version there might well be several script-breaking changes, particularly when setting which columns are to be editable. Please read the "Beginner's Guide" and look at the included example scripts to see where things have changed.
--------------------------------------------------------------------------------------
This UDF allows you to do much more with ListView controls (either native or UDF created):
Edit the content with plain text, combos or date-time pickers - and edit the headers too Move rows within the ListView Drag rows both within the ListView and to other ListViews in the same GUI (or not as required) Insert and delete columns and rows Sort columns by simply clicking the header Colour individual ListView items and headers Only select a single cell rather then the entire row Save and load entire ListViews For the advanced user: If you use certain Windows message handlers (In particular WM_NOTIFY) in your script, please read the function headers for the equivalent handlers within the UDF.
Here is the UDF, with 6 examples and the guide, in zip format: GUIListViewEx.zip
Credit to: martin (basic drag code), Array.au3 authors (array functions), KaFu and ProgAndy (font function), LarsJ (colouring code)
Happy to take compliments or criticism - preferably the former!
M23