Leaderboard
Popular Content
Showing content with the highest reputation on 09/06/2016 in all areas
-
After AutoIt 3.3.12.0 the handling of COM errors has been "fixed". Now nested COM operations crash the script in case of an error even when there is a COM error handler. Edit: All 3 problems have been fixed in AutoIt 3.3.14.3. Here you find a fixed version of function _Excel_RangeFind. I simply removed all nestings and added the missing COM error hander: Another function that needed some modification is _Excel_BookOpen. It crashed when a workbook was opened using _Excel_BookOpen with parameter $bVisible = True, saved and then reopened. The following modification solves the problem: 2017/06/19: Another function that needed some modification is _Word_DocSaveAs. It doesn't work with Word 2013 or later as MS felt the urge to change the name of the save method from SaveAs to SaveAs2. The following modification solves the problem: Please tell me if you still have problems with this or any other function from the Excel or Word UDF!1 point
-
The living example (or the correct way to group project)
argumentum reacted to iamtheky for a topic
Week of 9/5 FIRST OBJECTIVE: Connect and Authenticate I dont care which service we use, if enough people have it / or no one is opposed i would vote Twitter. I also, dont care if it becomes multiple examples for multiple services, the objective will be connection routines that are effective and optimal.1 point -
@All, Thanks for your comments and remarks. I think that I included all your wishes. Martin, yes but be aware that large text cells will be truncated in a Tooltip. The Fly-over makes the WM_NOTIFY a bit more complex So, why can't we display the multiline text straight away in the ListView, like a memo field or in Excel multiline data? Would be nicer no? GreenCan @Jamesbrooks, Press Print Screen... ; example of pop-up or ToolTip for multiline text items in ListView ; by GreenCan #include <GUIConstants.au3> #Include <GuiListView.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Global $View_multiline_ToolTip = True Global $Baloon_ToolTip = 1 ; should be 0 or 1 Global $Fly_Over = False Global $iLastItem = -1, $iLastsubitemNR = -1 Global $hGUI_Multiline, $View_Multiline, $ColName ; Multiline cell viewer window MsgBox(0,"Demo","Click on any cell, the cells containing multiple lines" & @CRLF & "will show a popup or ToolTip with the formatted text" & @CRLF & @CRLF & "Change '$NM_CLICK' to '$LVN_HOTTRACK'" & @CRLF & "for a fly-over effect", 10) $GUI = GUICreate("Listview with Pop-up for multiline cells") $hListView = GuiCtrlCreateListView("Title 1", 10, 10, 380, 350,-1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT )) ; fill with example data ; Add columns _GUICtrlListView_AddColumn ($hListView, "Title 2", 100) _GUICtrlListView_AddColumn ($hListView, "Title 3", 150) ; Add some rows _GUICtrlListView_AddItem($hListView, "A1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "A2" & @CRLF & "Example of multiline text", 1) _GUICtrlListView_AddSubItem($hListView, 0, "A3" & @CRLF & "Example of multiline text" & @CRLF & "3rd line", 2) _GUICtrlListView_AddItem($hListView, "B1", 1) _GUICtrlListView_AddSubItem($hListView, 1, "B2" & @CRLF & "Line 2" & @CRLF & "Line 3" & @CRLF & "Line 4", 1) _GUICtrlListView_AddSubItem($hListView, 1, "B3", 2) _GUICtrlListView_AddItem($hListView, "C1") _GUICtrlListView_AddSubItem($hListView, 2, "C2" & @CRLF & "Another multiline text", 1) _GUICtrlListView_AddSubItem($hListView, 2, "C3" & @CRLF & "Another Example of multiline text", 2) ; done ; configuration settings $multiline_ToolTip = GuiCtrlCreateCheckbox("Tooltip",10, 365, 70) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) If $View_multiline_ToolTip = True Then GuiCtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip($multiline_ToolTip, "Checked, Tooltip will be shown") Else GUICtrlSetTip($multiline_ToolTip, "Unchecked, Pop-Up will be shown") EndIf $Baloon_Tip = GuiCtrlCreateCheckbox("Baloon",80, 365, 70) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) If $Baloon_ToolTip = 1 Then GuiCtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip($Baloon_Tip, "Checked, Display as Balloon Tip Requires IE5+") Else GUICtrlSetTip($Baloon_Tip, "Unchecked, Normal Tooltip") EndIf $FlyOver = GuiCtrlCreateCheckbox("Fly-Over effect",150, 365, 100) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) If $Fly_Over = True Then GuiCtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip($FlyOver, "Checked, Fly-Over effect ") Else GUICtrlSetTip($FlyOver, "Unchecked, Click on Cell") EndIf GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ToolTip("") ; clean remaining ToolTip from WM_NOTIFY if necessary GUIDelete($GUI) Exit Case $msg = $multiline_ToolTip If $View_multiline_ToolTip = True then $View_multiline_ToolTip = False GUICtrlSetTip($multiline_ToolTip, "Unchecked, Pop-Up will be shown") ToolTip("") ; clean remaining ToolTip from WM_NOTIFY if necessary Else $View_multiline_ToolTip = True GUICtrlSetTip($multiline_ToolTip, "Checked, Tooltip will be shown") View_MultilineCell("") ; clean remaining Pop-up from WM_NOTIFY if necessary EndIf Case $msg = $Baloon_Tip If $Baloon_ToolTip = 1 then $Baloon_ToolTip = 0 GUICtrlSetTip($Baloon_Tip, "Unchecked, Normal Tooltip") Else $Baloon_ToolTip = 1 GUICtrlSetTip($Baloon_Tip, "Checked, Display as Balloon Tip Requires IE5+") EndIf Case $msg = $FlyOver If $Fly_Over = True then $Fly_Over = False GUICtrlSetTip($FlyOver, "Unchecked, Click on Cell") Else $Fly_Over = True GUICtrlSetTip($FlyOver, "Checked, Fly-Over effect ") EndIf EndSelect WEnd #FUNCTION# ============================================================== Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView If $Fly_Over = False Then Switch $iCode Case $NM_CLICK ; when clicking on a cell that is multiline, a tooltip will display the content Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) Local $iItem = DllStructGetData($tInfo, "Item") Local $subitemNR = DllStructGetData($tInfo, "SubItem") $Column_attribute =_GUICtrlListView_GetColumn($hListView, $subitemNR) ; if no cell change return without doing anything If $iLastItem = $iItem And $iLastsubitemNR = $subitemNR Then Return 0 $iLastItem = $iItem $iLastsubitemNR = $subitemNR Local $sToolTipData = _GUICtrlListView_GetItemText($hListView, $iItem,$subitemNR) $Mypos = StringInStr ( $sToolTipData, @CRLF ) If $Mypos > 0 Then If $View_multiline_ToolTip = True Then ToolTip($sToolTipData, MouseGetPos(0) + 20, MouseGetPos(1) + 20,"",0,$Baloon_ToolTip) Else View_MultilineCell($sToolTipData, $Column_attribute[5] & " Row " & $iItem +1) EndIf Else If $View_multiline_ToolTip = True Then ToolTip("") Else View_MultilineCell("") EndIf ;ConsoleWrite("R" & $iItem & "C" & $subitemNR & " No tip" & @CR) EndIf EndSwitch Else Switch $iCode Case $Fly_Over = True And $LVN_HOTTRACK; Sent by a list-view control when the user moves the mouse over an item Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) Local $iItem = DllStructGetData($tInfo, "Item") Local $subitemNR = DllStructGetData($tInfo, "SubItem") $Column_attribute =_GUICtrlListView_GetColumn($hListView, $subitemNR) ; if no cell change return without doing anything If $iLastItem = $iItem And $iLastsubitemNR = $subitemNR Then Return 0 $iLastItem = $iItem $iLastsubitemNR = $subitemNR Local $sToolTipData = _GUICtrlListView_GetItemText($hListView, $iItem,$subitemNR) $Mypos = StringInStr ( $sToolTipData, @CRLF ) If $Mypos > 0 Then If $View_multiline_ToolTip = True Then ToolTip($sToolTipData, MouseGetPos(0) + 20, MouseGetPos(1) + 20,"",0,$Baloon_ToolTip) Else View_MultilineCell($sToolTipData, $Column_attribute[5] & " Row " & $iItem +1) EndIf Else If $View_multiline_ToolTip = True Then ToolTip("") Else View_MultilineCell("") EndIf ;ConsoleWrite("R" & $iItem & "C" & $subitemNR & " No tip" & @CR) EndIf EndSwitch EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY #FUNCTION# ============================================================== Func View_MultilineCell($Cell_content,$Column_name= "") Local $Msg2 If $Cell_content = "" Then ; clicked on nonmultiline cell, so close the window $window_open = WinList ( "Cell Content" ) If $window_open[0][0] > 0 Then GUIDelete ( $hGUI_Multiline ) Return Else $window_open = WinList ( "Cell Content" ) ; check if window already exists If $window_open[0][0] = 0 Then ; if the window does not exist yet, create it Local $window_width = 300 Local $window_heigth = 300 $hGUI_Multiline = GUICreate("Cell Content", $window_width, $window_heigth, 1, 1, ( $WS_POPUPWINDOW), $WS_EX_TOPMOST,$GUI) $ColName = GUICtrlCreateLabel("Content of " & $Column_name, 10, 2, $window_width) $View_Multiline = GUICtrlCreateEdit($Cell_content, 5, 20, $window_width - 10, $window_heigth - 40, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlSetColor(-1, 0x2601D3) GUICtrlSetBkColor(-1, 0xEAFFE8) GUICtrlCreateLabel("Click on any non-multiline cell to hide this pop-up", 35, $window_heigth - 15, $window_width) GUICtrlSetFont (-1, 7 , 400 ) Else ; window already exist so only change the content GUICtrlSetData ( $ColName, "Content of " & $Column_name ) ; column title GUICtrlSetData ( $View_Multiline, $Cell_content ) ; cell content EndIf GUISetState() Return EndIf EndFunc ;==>View_MultilineCell #FUNCTION# ==============================================================1 point
-
lemony You need to use NM_CUSTOMDRAW notify for setting text size and color. #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <WinAPI.au3> Global Const $FW_BOLD = 700 Global $Font = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD) $hGUI = GUICreate("Test", 300, 200) $hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems", 10, 10, 280, 180, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) For $i = 1 To 10 _GUICtrlListView_AddItem($hListView, "Item" & $i) _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem" & $i, 1) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($Font) Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate('hwnd hwndFrom;int idFrom;int code;' & _ 'dword DrawStage;hwnd hdc;long rect[4];dword ItemSpec;int ItemState;dword Itemlparam;' & _ 'dword clrText;dword clrTextBk;int SubItem;' & _ 'dword ItemType;dword clrFace;int IconEffect;int IconPhase;int PartID;int StateID;long rectText[4];int Align', _ ;winxp or later $lParam) Local $iDrawStage = DllStructGetData($tCustDraw, 'DrawStage') If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW Local $iItem = DllStructGetData($tCustDraw, 'ItemSpec') Switch $iItem Case 5 DllStructSetData($tCustDraw, 'clrText', 0x5555DD) Local $hDC = DllStructGetData($tCustDraw, "hdc") _WinAPI_SelectObject($hDC, $Font) Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY1 point