DickG
Active Members-
Posts
181 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
DickG's Achievements
Prodigy (4/7)
1
Reputation
-
MrCheese reacted to a post in a topic:
Column names/widths in multi-dimensional array
-
DickG reacted to a post in a topic:
Dir2HTML (file structure to html document with treeview)
-
DickG reacted to a post in a topic:
[SOLVED] Change Z-ordering of controls
-
DickG reacted to a post in a topic:
How to create a modal gui?
-
DickG reacted to a post in a topic:
Trigger input ONLY when hitting enter
-
Setting color in cell using rasim's code
DickG replied to DickG's topic in AutoIt GUI Help and Support
Aha, that clears it up! Thanks much!!! Now I understand! -
DickG reacted to a post in a topic:
Setting color in cell using rasim's code
-
Setting color in cell using rasim's code
DickG replied to DickG's topic in AutoIt GUI Help and Support
I'm sorry, but I still don't get it. When I run your example, 0xFF4466 shows as dark pink, and 0x5555DD shows as dark purple. But if I use RGB2BGR() on those colors, I get dark purple for 0xFF4466 and dark pink for 0x5555DD. I'm not a classically trained programmer, so I don't get the bit shifting and bit ANDing that's needed. Here is a modified version of your test GUI to show that I get difference results when I use or don't use RGB2BGR(). I'd be grateful for a simple explanation. For example, how do I know when to use RGB2BGR() and when to not use it? I have to use it in the script I need to set a cell color in a Listview, but don't need it for setting other colors. #Include <GuiConstantsEx.au3> #Include <WindowsConstants.au3> GuiCreate("Color Test") GuiSetState() Local $Hex_graphic_A = GUICtrlCreateGraphic(20, 20, 150, 150) GUICtrlSetGraphic($Hex_graphic_A, $GUI_GR_RECT, 0, 0, 150, 150) GUICtrlSetGraphic($Hex_graphic_A, $GUI_GR_COLOR) GUICtrlSetBkColor($Hex_graphic_A, 0xFF4466) GUICtrlCreateLabel("0xFF4466 w/o RGB2BGR()", 30, 50, 120, 50) Local $Hex_graphic_B = GUICtrlCreateGraphic(200, 20, 150, 150) GUICtrlSetGraphic($Hex_graphic_B, $GUI_GR_RECT, 0, 0, 150, 150) GUICtrlSetGraphic($Hex_graphic_B, $GUI_GR_COLOR) GUICtrlSetBkColor($Hex_graphic_B, RGB2BGR(0xFF4466)) GUICtrlCreateLabel("0xFF4466 with RGB2BGR()", 210, 50, 120, 50) Local $Hex_graphic_C = GUICtrlCreateGraphic(20, 200, 150, 150) GUICtrlSetGraphic($Hex_graphic_C, $GUI_GR_RECT, 0, 0, 150, 150) GUICtrlSetGraphic($Hex_graphic_C, $GUI_GR_COLOR) GUICtrlSetBkColor($Hex_graphic_C, 0xFF0000) GUICtrlCreateLabel("0xFF0000 w/o RGB2BGR()", 30, 250, 120, 50) Local $Hex_graphic_D = GUICtrlCreateGraphic(200, 200, 150, 150) GUICtrlSetGraphic($Hex_graphic_D, $GUI_GR_RECT, 0, 0, 150, 150) GUICtrlSetGraphic($Hex_graphic_D, $GUI_GR_COLOR) GUICtrlSetBkColor($Hex_graphic_D, RGB2BGR(0xFF0000)) GUICtrlCreateLabel("0xFF0000 with RGB2BGR()", 210, 250, 120, 50) While GuiGetMsg()<>-3 Wend Func RGB2BGR($iColor) Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF) EndFunc -
Setting color in cell using rasim's code
DickG replied to DickG's topic in AutoIt GUI Help and Support
Aha! I would have never thought of that! Thanks much! PS: So why does $iColor = 0xFF4466 or $iColor = 0x5555DD work without this conversion? -
change the font of a single listview item
DickG replied to lemony's topic in AutoIt GUI Help and Support
Doh! OK, I didn't know. Thanks for letting me now. I will create a new topic. -
I am using rasim's code, which works pretty well. But if I change the color from 0xFF4466 to 0xFF0000, it still shows as 0xFF4466. Yet other colors work. Any idea why it doesn't like 0xFF0000? #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <FontConstants.au3> #include <WinAPI.au3> Global $Font1 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD) Global $Font2 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD, True) $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($Font1) _WinAPI_DeleteObject($Font2) 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($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage = DllStructGetData($tCustDraw, "dwDrawStage") If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW Local $iSubItem = DllStructGetData($tCustDraw, "iSubItem") Local $iItem = DllStructGetData($tCustDraw, "dwItemSpec") Local $iColor, $hDC Switch $iItem Case 5 $hDC = DllStructGetData($tCustDraw, "hdc") If $iSubItem = 0 Then $iColor = 0xFF4466 _WinAPI_SelectObject($hDC, $Font1) Else $iColor = 0x5555DD _WinAPI_SelectObject($hDC, $Font2) EndIf DllStructSetData($tCustDraw, "clrText", $iColor) Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
-
change the font of a single listview item
DickG replied to lemony's topic in AutoIt GUI Help and Support
rasim, I am trying to use your code to color-code cells. But when I set the color to 0xFF0000, it is still 0xFF4466. How can I set the color to red? -
DickG reacted to a post in a topic:
change the font of a single listview item
-
Up/Down counter that increments/decrements by 0.1
DickG replied to DickG's topic in AutoIt GUI Help and Support
Melba, I finally figured out how to do this without using the WM_COMMAND() function. #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Dim $IntRate_val = "" Dim $IntRate = 5.0 Dim $Close_btn Dim $idMsg Example() Func Example() Local $ThisFunc = "Example" GUICreate("GUI Up/Down", 200, 200, -1, -1, $WS_SIZEBOX) $IntRate_label = GUICtrlCreateLabel(StringFormat("%.01f", $IntRate) & " ", 40, 10, 50, 20) GUICtrlSetBkColor($IntRate_label, 0xFFFFFF) $IntRate_val = GUICtrlCreateInput($IntRate, 90, 10, 20, 20) GUICtrlCreateUpdown($IntRate_val) $Close_btn = GUICtrlCreateButton("Close", 80, 120, 50, 30) ;Save IntRate for comparison in While loop. $IntRate_cur = $IntRate While 1 GUISetState(@SW_SHOW) $idMsg = GUIGetMsg() Switch $idMsg Case $GUI_EVENT_CLOSE ExitLoop Case $IntRate_val ;If clicked UP, increment by 0.1. If GUICtrlRead($IntRate_val) > $IntRate_cur Then;clicking control increments or decrements value by 1. $IntRate += 0.1 GUICtrlSetData($IntRate_label, $IntRate) ;Increment $IntRate_cur by 1. $IntRate_cur += 1 ;If clicked DOWN, decrement by 0.1. Else $IntRate -= 0.1 GUICtrlSetData($IntRate_label, $IntRate) ;Decrement $IntRate_cur by 1. $IntRate_cur -= 1 EndIf Case $Close_btn Exit EndSwitch WEnd EndFunc The thing that I discovered was that the up/down counter can only change by 1. So I used your "trick" of using a label to display the value, and the up/down counter to make the change. It first saves the starting value ($IntRate_cur = $IntRate), then checks of the up/down counter when up or down by one. If up, in increments $IntRate by 0.1 and increments $IntRate_cur by 1. Etc. The tricky part is to size and position the label and up/down counter to appear as one control. So your "trick" worked great. I would have never thought of that. Thanks again -
Interesting! I have no idea how I might have done that, as there is no keyboard shortcut for it. I didn't even know about that command. But it's the only possible thing that could have happened. Thanks for the reply.
-
Today, I found that every one of my UDF functions had a line inserted at the top like this: ConsoleWrite('@@ (6068) :(' & @MIN & ':' & @SEC & ') <function name>()' & @CR) ;### Function Trace It was only in one of my UDF files. I have no idea how it got there. Maybe I did something by accident. Does anyone know how it got there? I couldn't find anything about this in the Help file or online.
-
Up/Down counter that increments/decrements by 0.1
DickG replied to DickG's topic in AutoIt GUI Help and Support
Melba, your version certainly works well. I had to play around with it a lot to figure out how you were doing it. Now I think I got it. It looks like you are using a dummy label in place of the input control's text, and an input control with up/down control sized and positioned to see only the up/down arrow. Then you make it go up/down by 0.1 by dividing the label's value by 10. So you must then multiply the input value by 10. Am I right? I managed to size/position the controls in my own scrip. But I still need to get it to set the label to the right value. Haven't figured that out yet. It changes from 5.0 to 0.1 instead of 5.1. But I'll keep working on it. Thanks much for this. So I guess there's really no other way to use an up/down control to change the value by 0.1? -
I am trying to get an Up/Down counter to change by 0.1 increments. I can get it to go up OR down by 0.1. But if I go UP, then back down, it still goes up for a while, then it goes down from a higher number. The same thing happens when I go DOWN: If I go down, then back up, it still goes down for a while, then goes up again from a lower number. I'm baffled by that action. This is the test code: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Local $IntRate_val = "" Local $IntRate = 5.0 Local $Close_btn Local $idMsg Example() Func Example() Local $ThisFunc = "Example" GUICreate("GUI Up/Down", 200, 200, -1, -1, $WS_SIZEBOX) Local $IntRate_val = GUICtrlCreateInput($IntRate, 20, 20, 60, 30) GUICtrlCreateUpdown($IntRate_val) $Close_btn = GUICtrlCreateButton("Close", 80, 120, 50, 30) While 1 GUISetState(@SW_SHOW) $idMsg = GUIGetMsg() Switch $idMsg Case $GUI_EVENT_CLOSE ExitLoop Case $IntRate_val ;If clicked UP, increment by 0.1. If Number(GUICtrlRead($IntRate_val)) > $IntRate Then $IntRate += 0.1 ConsoleWrite(" Up: IntRate: " & $IntRate & @CR) GUICtrlSetData($IntRate_val, $IntRate) EndIf ;If clicked DOWN, decrement by 0.1. If Number(GUICtrlRead($IntRate_val)) < $IntRate Then $IntRate -= 0.1 ConsoleWrite(" Down: IntRate: " & $IntRate & @CR) GUICtrlSetData($IntRate_val, $IntRate) EndIf Case $Close_btn Exit EndSwitch WEnd EndFunc ;==>Example I'd be grateful for some insight into this.
-
How to create a Time control like GUICtrlCreateDate
DickG replied to DickG's topic in AutoIt GUI Help and Support
Thanks much, Melba and Autobert. That got me started. I managed to figure out how to create and set the time control after much testing, starting with your suggestions. I need to read the time from an INI, then set the Time control. The INI stores the time like this: "7:15 PM" or "11:30 AM". So I had to first look for "AM" or "PM" in the string, parse that out, split the string, then add 12 if it was PM. Like this: If StringInStr($Time, "PM") Then $Time = StringReplace($Time, " PM", "") $Time_split = StringSplit($Time, ":") $Time = $Time_split[1] + 12 & ":" & $Time_split[2] Else $Time = StringReplace($Time, " AM", "") $Time_split = StringSplit($Time, ":") $Time = $Time_split[1] & ":" & $Time_split[2] EndIf $Time_val = GUICtrlCreateDate($Time, $Left, $Top, $Width, $Height, $DTS_TIMEFORMAT) GUICtrlSendMsg($Time_val, $DTM_SETFORMATW, 0, $Style_time) I use $Style_time ="h:mm tt" to show a 12-hr clock with AM or PM appended. When I want to create the control to show the current time, I use "" instead of $Time when creating the control. But I found that I MUST create the control AFTER I display the GUI that will contain it. I have no idea why. Maybe this will help others on how to set a Time control from an external value. -
how to change backup strategy in SciTE
DickG replied to DickG's topic in AutoIt Technical Discussion
OK, thanks Jos. -
How can I change this to <filename>.bak.<n>.au3? Right now, backup files take the form <filename>.au3.<n>.bak. I can't find anything in the SciTE forum or the AutoIt forum on this. And can't find any setting in any of the SciTE config files. The reason I want to change it is because when I want to view a backup file, d-clicking on it opens it in a text format, so doesn't have the syntax highlighting like an au3 file does. So it's hard to compare to a regular .au3 file.