Jump to content

bourny

Active Members
  • Posts

    325
  • Joined

  • Last visited

Profile Information

  • Location
    UK - Newcastle

Recent Profile Visitors

265 profile views

bourny's Achievements

Universalist

Universalist (7/7)

0

Reputation

  1. You are very kind Melba23. Thanks for the offer.
  2. Melba23, That worked on your code. I can now detect the column resize in example6. I am running an older version of your Mod (3.3 +) which looks like the Mod has been overhauled and a lot of functions have been deprecated. I will need to try and migrate my program to your new Mod to take advantage of the new feature. Thanks for the time working on this. bourny
  3. Hi Melba23, It looks fine when I resize on example 6. I am absolutely sure this is something to do with the way I am rendering my Gui or the graphic attached to it. I am looking to create a simplified version of my core Gui to troubleshoot where its going wrong. For now I can cope with it until I get a chance to troubleshoot however I was hoping to put a quick fix in place for now which is to simply refresh the Gui if I detect someone has resized a column. Your list view is perfect for my needs and it will be my poor implementation that is causing this issue. Do you think there is a way to detect this extending of the column in your Mod. I am already making good use of your left click and right click detection to do things which is working well. bourny.
  4. Hi, I am using @Melba23 GuiListViewEx for my gui. I am having difficulty when resizing the column it causes the list view to look broken up until I refresh it. This will be down to the way I have coded the program however, I would like to put a quick work around in to detect when someone is resizing a column and force the refresh. Problem is I cannot detect the column being resized. I have tried using an example of the below code i found on the forum to see if I can detect the list view expansion which I can. I then tried to add some code to the GuiListViewEx to see if the same would work but did not. First code snippet below is a part I found on the forum. The second code snippet is from the GuiListViewEX I tried to add. #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <HeaderConstants.au3> ; The 0-based column to be disabled Global $iFix_Col, $hHeader _Main() Func _Main() Local Const $hGUI = GUICreate("ListView Fix Column Width", 400, 300) Local Const $hListView = GUICtrlCreateListView("Column 0|Column 1|Column 2|Column 3", 2, 2, 394, 268) $hHeader = _GUICtrlHeader_Create($hGUI) GUISetState(@SW_SHOWNORMAL) ; Prevent resizing of column 1 $iFix_Col = 1 GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Get details of message Local Const $tNMHEADER = DllStructCreate($tagNMHEADER, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") Local Const $iCode2 = DllStructGetData($tNMHEADER, "Code") Switch $hWndFrom Case $hHeader Switch $iCode2 Case $WM_SETCURSOR Return True EndSwitch EndSwitch Switch $iCode2 Case $HDN_BEGINTRACKW ; Now get column being resized Local $iCol = DllStructGetData($tNMHEADER, "Item") ;If $iCol = $iFix_Col Then ; Prevent resizing ; Return True ;Else consolewrite("Detected Resize" & @lf) ; Allow resizing Return False ;EndIf EndSwitch EndFunc ;==>_WM_NOTIFY Here is Melba23`s function extract code which I unsuccessfully spliced the above detection for $HDN_BeginTrackw. I also tried changing it to $LVN_BeginTrackw (Guess) which also failed to detect the resize. Clearly I dont understand the DllStructGetData enough to splice this or add code to enable the drag detection. I also looked on Dr Google for some idea of what libraries are available but what I found I dont fully understand enough to add the correct code. ; #FUNCTION# ========================================================================================================= ; Name...........: _GUIListViewEx_WM_NOTIFY_Handler ; Description ...: Windows message handler for WM_NOTIFY ; Syntax.........: _GUIListViewEx_WM_NOTIFY_Handler() ; Requirement(s).: v3.3 + ; Return values .: None ; Author ........: Melba23 ; Modified ......: ; Remarks .......: If a WM_NOTIFY handler already registered, then call this function from within that handler ; Example........: Yes ;===================================================================================================================== Func _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return ; Check if enabled ListView or header For $iLV_Index = 1 To $aGLVEx_Data[0][0] If $aGLVEx_Data[$iLV_Index][0] = DllStructGetData($tStruct, 1) Then ExitLoop EndIf Next If $iLV_Index > $aGLVEx_Data[0][0] Then Return ; Not enabled Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) ;-------------Added by Bourny Local Const $tNMHEADER = DllStructCreate($tagNMHEADER, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") Local Const $iCode2 = DllStructGetData($tNMHEADER, "Code") ;Switch $hWndFrom ; Case $hHeader ; Switch $iCode2 ; Case $WM_SETCURSOR ; Return True ; EndSwitch ;EndSwitch Switch $iCode2 Case $HDN_BEGINTRACKW ; Now get column being resized Local $iCol = DllStructGetData($tNMHEADER, "Item") ;If $iCol = $iFix_Col Then ; Prevent resizing ; Return True ;Else consolewrite("Detected Resize" & @lf) ; Allow resizing Return False ;EndIf EndSwitch ;-------------Added by Bourny Switch $iCode Case $NM_RCLICK $iIndex = _GUICtrlListView_GetSelectedIndices($hListView_Right) any help appreciated.
  5. @iamtheky - Works in my live program so looking good. Splits exactly as it should and overcomes the issue I initially faced. I am spoilt for choice on which solution to use.
  6. As always I am impressed with the response from the forum. @mikell - Very nice use of the file output to extract the information I need. Never considered this approach. @iamtheky - You have done this in less lines of code and I will be interested why the " " empty space has not worked but instead the @LF has worked but clearly a difference. I am impressed with your simple solution . @autoBurt - Very simple idea by combining the array elements to produce the same result. Thankyou all for your contributions and showing the various ways of tacking this problem
  7. @Marc and @FrancescoDiMuro - Thanks for the explanation and link to the guide on this. I will spend some time understanding this so I can use this going forward for tricky strings like this. I can usually deal with any stings but seemingly this one defeated me. i have applied this to my core script and its working perfectly. Appreciate the time you spent on this.
  8. @Marc - Perfect. Exactly what I need. I will see if I can understand what you did here with the string pattern as clearly I do not understand that bit and how its used. @FrancescoDiMuro - This is also the exact solution I need and I will need to also understand the sting pattern used here as I do not understand it. Also thanks for the compliment on the SRE. $strPattern = '(\w+)(?:=")([^"]+)(?:")(?:\s?)'
  9. Hi, I am trying to split a string that has multiple spaces but I need to split by the spaces. The issue I have is there is parts in the quotes that also have spaces. example is below. My ultimate goal is to split the line and return the following array 0 - CPU="AMD 64" 1 - OSType="64 bit" 2 - OS="Windows server 2012 R2" 3 - Bootfirmware= "Bios" The attempt 2 below gets very close to this but I am having to blag it by splitting the string with singlequote+space which is a crude way and could voilate any parts of a longer string that does not conform to this rule. #include <String.au3> #include <Array.au3> ;Attempt 1 ;This gives me the parts inside the quotes but I have no way to see the tags that they belong to $String = 'CPU="AMD 64" OSType="64 bit" OS="Windows server 2012 R2" bootfirmware="Bios"' Local $aArray = _StringBetween($String, '="', '"') _ArrayDisplay($aArray) $start = 1 For $element in $aArray $pos = StringInStr($String, $element) Next ;Attempt 2 - Split by space however this does work to an extent only because I am using the qotes and space however this could be violated by something in a much longer string that does not conform. $aArrayOfEntries = StringSplit($String, '" ', $STR_ENTIRESPLIT ) _ArrayDisplay($aArrayOfEntries) Any help appreciated.
  10. The question was more to discuss the idea of what I am doing which may be a standard way the Gui`s work. The code is over 10k lines ling and this issue could be caused by any part of the many functions. I can close this thread if we cannot discuss a general issue without having code attached. I was hoping someone may say they have seen this or this is standard behaviour and you simply need to use some sort of break function or adlib function to get out of a list view populate. i will need to create a test code to emulate what is happening and come back to the forum Apologies.
  11. Hi, I have a workflow program with a nice GUI using multiple tabs and various combo boxes with list views. The whole thing uses a SQL database with queries in the code to populate the list view depending on what is chosen from the combo menu. All this works great however I have discovered something that does cause me some annoyance. If I change my mind and change the combo selection or add a filter using another one of the combo`s the new selection will not apply immediately but instead wait until the current selection has loaded and then apply the new selection. Even better if I choose for an example 5 different combo selections while I am waiting for the first one to complete loading it will remember what I have chose and proceed to execute these in order. That can become a problem If I have incorrectly selected 5 options or used my mouse wheel to accidentally select other options in the combo. I guess there is something I can put in my code to tell the program to stop processing a list view population or another activity if a user chooses something else. any help appreciated.
  12. Thanks .... I found it also and managed to embed a function into Melba23`s UDP to pass through the indices to allow me to simply loop through the list view with a counter that displays the item once the counter matches the indices. Func _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return ; Check if enabled ListView or header For $iLV_Index = 1 To $aGLVEx_Data[0][0] If $aGLVEx_Data[$iLV_Index][0] = DllStructGetData($tStruct, 1) Then ExitLoop EndIf Next If $iLV_Index > $aGLVEx_Data[0][0] Then Return ; Not enabled Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) Switch $iCode Case $NM_RCLICK $iIndex = _GUICtrlListView_GetSelectedIndices($hListView_Right) ShowRightClickedItem($iIndex) ConsoleWrite("An Item Was clicked with the left mouse button" & @crlf) Case $NM_CLICK ConsoleWrite("An Item Was clicked with the left mouse button" & @crlf)
  13. Hi, I am using Melba23`s UDF for my list view controls. I am having difficulty trying to work out how to detect the item on the list view under the selection. So far I can edit the UDF itself to give me an output of the array if I left or right click but I cannot isolate the item that is actually selected. Here is what I have edited in the UDF however I do not want to edit the udf itself as this is unwise and I would rather call Melba23`s functions to return the information I need. Here is the UDF code I have been playing with but again this this not what I want to do editing the UDF. Func _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If @error Then Return ; Check if enabled ListView or header For $iLV_Index = 1 To $aGLVEx_Data[0][0] If $aGLVEx_Data[$iLV_Index][0] = DllStructGetData($tStruct, 1) Then ExitLoop EndIf Next If $iLV_Index > $aGLVEx_Data[0][0] Then Return ; Not enabled Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) Switch $iCode Case $NM_RCLICK ; Set values for active ListView $aGLVEx_Data[0][1] = $iLV_Index $hGLVEx_SrcHandle = $aGLVEx_Data[$iLV_Index][0] $cGLVEx_SrcID = $aGLVEx_Data[$iLV_Index][1] ; Get and store item index $aGLVEx_Data[0][4] = DllStructGetData($tStruct, 4) If IsArray($aGLVEx_Data[$iLV_Index][4]) Then ; Load array $aGLVEx_SrcArray = $aGLVEx_Data[$iLV_Index][2] ; Load current ListView sort state array ; Local $aLVSortState = $aGLVEx_Data[$iLV_Index][4] ; Sort column - get column from from struct ; _GUICtrlListView_SimpleSort($hGLVEx_SrcHandle, $aLVSortState, $iCol) ; Store new ListView sort state array ; $aGLVEx_Data[$iLV_Index][4] = $aLVSortState ; Reread listview items into array Local $iDim2 = UBound($aGLVEx_SrcArray, 2) - 1 For $j = 1 To $aGLVEx_SrcArray[0][0] For $k = 0 To $iDim2 $H = _GUICtrlListView_GetItemText($hGLVEx_SrcHandle, $j - 1, $k) $aGLVEx_SrcArray[$j][$k] = $H msgbox(0, "", $H) Next Next ;_ArrayDisplay($aGLVEx_SrcArray) ; Store amended array $aGLVEx_Data[$iLV_Index][2] = $aGLVEx_SrcArray ; Delete array $aGLVEx_SrcArray = 0 EndIf ; Create Local array for checkboxes (if no checkboxes makes no difference) ; Create Local array for checkboxes (if no checkboxes makes no difference) ConsoleWrite("An Item Was clicked with the left mouse button" & @crlf) Case $NM_CLICK ConsoleWrite("An Item Was clicked with the left mouse button" & @crlf)
  14. Melba, I am currently using GuiListViewEx as the core of my application. I am currently reading the check boxes by looping through the listview looking for the checked item. This works but is expensive to do. Is there a way of using _GUIListViewEx_WM_NOTIFY_Handler to look for the event and simply read the row that was clicked. I have tried adding something like the below into your WM_Notify function and cannot seem to get it to detect a click of the checkbox. Case $NM_CLICK $Check = _GUICtrlListView_GetItemChecked($hGLVEx_SrcHandle ,$iCol) ConsoleWrite($Check & @CRLF) what's your recommendation for detecting a check box has been clicked and return the data in the corresponding row. Thanks
  15. Perfect, Thanks InunoTaishou. If only I had just read the help file with my eyes a bit more open.
×
×
  • Create New...