Werty Posted April 7, 2021 Share Posted April 7, 2021 How about now... #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> #include <Misc.au3> Local $hGui, $hRichEdit, $iMsg Local $hUser32 = DllOpen("user32.dll") $hGui = GUICreate("Hide caret example", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY )) _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is more text") GUISetState(@SW_SHOW) Local $aResult = DllCall($hUser32, "int", "HideCaret", "hwnd", $hRichEdit) ; <--- this hides caret While True $iMsg = GUIGetMsg() If _IsPressed("01", $hUser32) Then DllCall($hUser32, "int", "HideCaret", "hwnd", $hRichEdit) EndIf Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes ; GUIDelete() ; is OK too Exit EndSelect WEnd Professor_Bernd 1 Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 7, 2021 Author Share Posted April 7, 2021 (edited) Oh great! I've been experimenting with Windows messages from this C++ solution all this time, focusing on GetFocus, KillFocus and WM_LBUTTONDOWN and didn't come up with the simple solution with "_IsPressed"! Thanks a lot for your solution! Edit: Link inserted Edited April 7, 2021 by Professor_Bernd Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 7, 2021 Author Share Posted April 7, 2021 If _IsPressed("01", $hUser32) Or _IsPressed("02", $hUser32) Then With the right mouse button it doesn't seem to work, ... but that is not important! The left mouse button is enough. Link to comment Share on other sites More sharing options...
Werty Posted April 7, 2021 Share Posted April 7, 2021 That's kinda wierd actually. This works though... If _IsPressed("", $hUser32) Then Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 If one presses the Tab key, the complete text is selected in the RichEdit. To prevent this I use this code from MrCreatoR. Thanks a lot @MrCreatoR! This also gives me the function "_IsFocused()" and I use it now to execute the DllCall(..., "HideCaret", ...) all the time when the RichEdit has the focus. Can anyone tell me if this causes problems when the DllCall(..., "HideCaret", ...) is called all the time? expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Global $g_hRichEdit Global $g_hUser32 = DllOpen("user32.dll") Example() DllClose($g_hUser32) Func Example() Local $hGui, $iMsg Local $bHotkeyForTabIsSet = False $hGui = GUICreate("Hide caret example", 320, 350, -1, -1) $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) _GUICtrlRichEdit_SetCharColor($g_hRichEdit, 0xFF0000) _GUICtrlRichEdit_AppendText($g_hRichEdit, @CRLF & "This is more text") GUISetState(@SW_SHOW) DllCall($g_hUser32, "int", "HideCaret", "hwnd", $g_hRichEdit) ; <--- this hides caret initially While True $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($g_hRichEdit) ; needed unless script crashes ; GUIDelete() ; is OK too ExitLoop EndSwitch If _IsFocused($hGui, $g_hRichEdit) Then DllCall($g_hUser32, "int", "HideCaret", "hwnd", $g_hRichEdit) ; <--- this hides caret ; Intercepting the tab key. If $bHotkeyForTabIsSet = False Then $bHotkeyForTabIsSet = True HotKeySet("{TAB}", "TabPress") ; <= It's just a dummy function because the RichEdit is read-only. EndIf Else If $bHotkeyForTabIsSet = True Then $bHotkeyForTabIsSet = False HotKeySet("{TAB}") EndIf EndIf ; If _IsFocused($hGui, $g_hRichEdit) WEnd EndFunc ;==>Example ; Autor: MrCreatoR, 2007-10-01. ; https://www.autoitscript.com/forum/topic/54322-edit-control-tab-key/?do=findComment&comment=411666 Func TabPress() ; Send("^{TAB}") ;This is the tip from Siao - Thanks! EndFunc ;==>TabPress ; Autor: MrCreatoR, 2007-10-01. ; https://www.autoitscript.com/forum/topic/54322-edit-control-tab-key/?do=findComment&comment=411666 Func _IsFocused($hWnd, $nCID) Return ControlGetHandle($hWnd, '', $nCID) = ControlGetHandle($hWnd, '', ControlGetFocus($hWnd)) EndFunc ;==>_IsFocused Link to comment Share on other sites More sharing options...
argumentum Posted April 8, 2021 Share Posted April 8, 2021 use a web page in a disabled IE. Add some nice JavaScript ( and share it here for me to use ) Professor_Bernd 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 I'm afraid by the time I've mastered html and javascript to the point where I can create a web page, IE will probably be gone. argumentum 1 Link to comment Share on other sites More sharing options...
Shark007 Posted April 8, 2021 Share Posted April 8, 2021 15 hours ago, argumentum said: ( and share it here for me to use ) +1 I currently use a msgbox so anything would be a step up Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 7 minutes ago, Shark007 said: I currently use a msgbox so anything would be a step up That was the same for me, I also used a MsgBox until now. That was the reason why I was looking for something nicer. Unfortunately I found only 3 example codes, but they were all very old (2004 - 2007) and very simple. For example, none has an area for credits. With the tip from Danyfirex it will now hopefully be a little prettier, but that is known to be a matter of taste. 13 minutes ago, Shark007 said: 16 hours ago, argumentum said: ( and share it here for me to use ) +1 I currently use a msgbox so anything would be a step up I think the HTML About dialog was a joke by argumentum. (If not, argumentum please excuse me!)please excuse!) Further up Chimp posted a short HTML example and I wrote of my modest HTML skills. I probably won't create an HTML About dialog anytime soon. However, if you're interested in the About Dialog I'm putting together, I'll be happy to share it once it's done. Shark007 1 Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 Preview Spoiler Werty and argumentum 1 1 Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 Does anyone feel like creating a demo RTF with made up About text and made up credits? The RTF will be displayed in the left pane. As seen in the preview, feel free to make it a bit colorful and it should contain URLs and links. The demo RTF should only contain fake data, not real data. Link to comment Share on other sites More sharing options...
Gianni Posted April 8, 2021 Share Posted April 8, 2021 ...since you are adamant in wanting to use rtf (... ), you can use the built-in Windows WordPad program or an online RTF editor to create and save your rtf "document" and then use the _GUICtrlRichEdit_StreamFromFile command to load it into the RichEdit control ... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Werty Posted April 8, 2021 Share Posted April 8, 2021 I like how you talk about very old examples and then post a preview in 90's style layout with dark background and colored text. Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 I have already done that. I load the RTF file with: _GUICtrlRichEdit_SetText($g_hRichEdit, FileRead($sPathRTF)) 3 minutes ago, Werty said: I like how you talk about very old examples and then post a preview in 90's style layout with dark background and colored text. That's because my artistic skills are as great as my HTML skills! Link to comment Share on other sites More sharing options...
Werty Posted April 8, 2021 Share Posted April 8, 2021 Oh, it was in no way meant as an critisism of your fine art, old stuff can be nice, I guess I just became nostalgic. Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 I didn't take that as a criticism either. It's just that my design skills are quite modest. That reminds me: Since your design skills are certainly better than mine, could you create a demo RTF described above? I would be very happy and I can continue working on the code in the meantime. And I'm eager to see your design. Link to comment Share on other sites More sharing options...
Werty Posted April 8, 2021 Share Posted April 8, 2021 I have absolutely ZERO experience with RTF, never used it. How about a logo ? Professor_Bernd and Musashi 1 1 Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Professor_Bernd Posted April 8, 2021 Author Share Posted April 8, 2021 13 minutes ago, Werty said: I have absolutely ZERO experience with RTF, never used it. It's not bad, I'll get it done, just takes a little longer. Right now I'm trying to make the code as suitable and easy to use for everyone as possible. 7 minutes ago, Werty said: How about a logo ? That would be so cool! I would totally love a logo! I've often thought about a logo, but you know: my design skills ... "PSPad4AutoIt3" is way too long for a logo, of course. If you take as a basis "Pau3", can you do something with it? That would be really cool! By the way, your logo in the post above is good too! (only too wide for a SysTray icon) Link to comment Share on other sites More sharing options...
Werty Posted April 9, 2021 Share Posted April 9, 2021 (edited) oh, so now you need Icon, well, they have to be square and should not contain text as the resolution is too small for text to look good, any icon with text is an ugly icon. Maybe something like this instead of text, still both the au3 and pspad logos.. I've been a little sloppy on the transparency job, I can fix it if you are gonna use it, didnt want to waste time if you're not going to use it. Here's how it looks in 256x256, 128x128, 64x64, 32x32, 16x16... /edit hmmm..... Edited April 9, 2021 by Werty added alternative Musashi, argumentum, Professor_Bernd and 1 other 4 Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Zedna Posted April 9, 2021 Share Posted April 9, 2021 Here is my old example with simple hyperlinks in About window Resources UDF ResourcesEx UDF AutoIt Forum Search 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