-
Posts
271 -
Joined
-
Last visited
-
Days Won
2
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by TheAutomator
-
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
UPDATE: Scrollbar working as intended now! New buttons added. New code (uploaded + new zip file) ready for you to test. Optimizations and details like handling double clicking on controls are comming soon. -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
Noted, good advice! Now I understand why you needed WS_CLIPSIBLINGS -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
Yeah, and moving the cursor down or up so that the edit updates also changes the tumb position @Nine detected when the tumb was pressed in the main loop by ctrl id, and so did you, but that means an extra block of code, using _ispressed, and an extra fuction to update some variables, so i skipped that part ( not sure if that's a good approach but it's working 😛 ) Gonna put this and some other fixes in the MiniMark code soon. you helped me a lot, thanks for that! -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
@pixelsearch Found some time to make a simple example to wrap my head around the example you gave me I managed to boil it down to the code below for testing. Gonna skip resizing the tumb and double clicks for this test, do you see any flaws in the test scrollbar I made? The thing I did diffirently is how to handle the WM_COMMAND message to prevent it setting the tumb location twice while dragging the tumb: if $Scrolling then Return $GUI_RUNDEFMSG #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <Misc.au3> #include <SendMessage.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $s For $i = 1 To 100 $s &= 'Line ' & $i & @crlf Next AutoItSetOption('MouseCoordMode', 2) ; 2 = relative coords to the client area of the active window $Form = GUICreate('Form', 294, 432, 2034, 330) $Text = GUICtrlCreateLabel(0, 0, 0, 200, 17) $Edit = _GUICtrlRichEdit_Create($Form, $s, 120, 70, 100, 270, BitOR($es_multiline, $es_autovscroll, $es_nohidesel), 0) _GUICtrlRichEdit_SetScrollPos($Edit, 0, 0) $Bar = GUICtrlCreateLabel('', 70, 70, 40, 270, $SS_BLACKRECT) $Tumb = GUICtrlCreateLabel('', 70, 70, 40, 80, $SS_GRAYRECT) GUISetState(@SW_SHOW) ;----------------------------------------------- $BarX = 70 $BarY = 70 $BarWidth = 40 $BarHeight = 270 $TumbX = 70 $TumbY = 70 $TumbHeight = 80 $TumbMax = $BarY + $BarHeight - $TumbHeight $TumbPercent = 0 $EditHeight = 270 $LineFirst = 0 $LineLast = 0 $LineCount = 0 $LineVisible = 0 $LineTop = 0 $EditPercent = 0 $MouseY = 0 $Scrolling = False ;----------------------------------------------- func MouseOnTumb() local $MouseXY = MouseGetPos() Return $MouseXY[0] >= $BarX and $MouseXY[0] <= $BarX + $BarWidth and $MouseXY[1] >= $BarY and $MouseXY[1] <= $BarY + $BarHeight EndFunc GUIRegisterMsg($WM_COMMAND, WM_COMMAND) Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) if $Scrolling then Return $GUI_RUNDEFMSG If $lParam = $Edit Then If BitShift($wParam, 16) = $EN_UPDATE Then UpdateTumbPosition() EndIf Return $GUI_RUNDEFMSG EndFunc Func UpdateTumbPosition() $LineFirst = _GUICtrlRichEdit_GetNumberOfFirstVisibleLine($Edit) $LineLast = _GUICtrlRichEdit_GetLineNumberFromCharPos($Edit, _GUICtrlRichEdit_GetCharPosFromXY($Edit, 1, $EditHeight)) $LineCount = _GUICtrlRichEdit_GetLineCount($Edit) $LinesVisible = $LineLast - $LineFirst + 1 ; count last visible line too (+1) $MaxScroll = $LineCount - $LinesVisible If $MaxScroll <= 0 Then $EditPercent = 0 Else $EditPercent = ($LineFirst - 1) / $MaxScroll EndIf GUICtrlSetData($text, $EditPercent) $TumbY = $BarY + $EditPercent * ($BarHeight - $TumbHeight) GUICtrlSetPos($Tumb, $TumbX, $TumbY) EndFunc Func UpdateEditPosition() $MouseY = MouseGetPos(1) $TumbY = $MouseY - $TumbHeight / 2 If $TumbY < $BarY Then $TumbY = $BarY If $TumbY > $TumbMax Then $TumbY = $TumbMax GUICtrlSetPos($Tumb, $TumbX, $TumbY) $TumbPercent = ($TumbY - $BarY) / ($TumbMax - $BarY) GUICtrlSetData($Text, $TumbPercent) $LineFirst = _GUICtrlRichEdit_GetNumberOfFirstVisibleLine($Edit) $LineLast = _GUICtrlRichEdit_GetLineNumberFromCharPos($Edit, _GUICtrlRichEdit_GetCharPosFromXY($Edit, 1, $EditHeight)) $LineCount = _GUICtrlRichEdit_GetLineCount($Edit) $LinesVisible = $LineLast - $LineFirst $LineTop = $TumbPercent * ($LineCount - $LinesVisible) + 1 _GUICtrlRichEdit_ScrollLines($Edit, $LineTop - $LineFirst) EndFunc ;----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($Edit) GUIDelete($Form) Exit Case $gui_event_primarydown if MouseOnTumb() then $Scrolling = True Case $gui_event_mousemove if $Scrolling then UpdateEditPosition() Case $gui_event_primaryup $Scrolling = False EndSwitch WEnd -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
-
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
Pixelsearch, I will have a look at it soon, looks promising thanks for this! -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
yep.. but I don't understand the code of Nine very well, and I only want to implement the scrollbar part (and like to know what i'm doing instead of accidentally creating memory leaks), feel free to help if you wanna add such scrollbar and/or understand Nine's code From what I understand from it, it uses a lot of DllCallbackRegisters, DllCallbackGetPtrs, and api calls like "_WinAPI_SetWindowSubclass", a bit of Chinese to me -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
New BETA version 4 uploaded as ZIP-file! see shortcuts section in code for the new ones installer and stable release coming soon! -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
Update, you can now save some settings to an ini file search function done code is better organized UPLOAD HAPPENING SOON Screenshot: Issues: New bug detected for saving and loading zoom settings for the edit control: -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
Update, The code is getting a huge update, that's why it takes a little longer for me to post the new version. I also found a solution for the scrollbar that finds the balance between simplicty and performance, it now updates how it should and works a little diffirently. Implementing your own scrollbar is not the most easy task I learned, but a lot of people have showed me inspiring code and examples. Updates coming soon: • better search gui in same style and functions • better gui design with stylized popup messages • no 100 images anymore, but just a few with the text on them being generated on the fly • final touches on the graphics • save as function added I also wanna thank Nine for giving me some new insight in the more low level functions of autoit, and everyone in this topic for all the idea's and effort: Please have a look at Nine's UDF, it's very cool! Also the windows "dark mode" one Regards! -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
Understood thanks anyways! So far I had this unfinished draft: Global $hScrollProc Func CreateCustomScrollbar() $hScrollProc = DllCallbackRegister(ScrollBarProc, 'lresult', 'hwnd;uint;wparam;lparam;uint_ptr;dword_ptr') _WinAPI_SetWindowSubclass(GUICtrlGetHandle($minimark_thumblabel), DllCallbackGetPtr($hScrollProc), 0, 0) EndFunc Func ScrollBarProc($hWnd, $iMsg, $wParam, $lParam, $iID, $iData) If $iMsg <> $WM_LBUTTONDOWN Then Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) Local $iYStart = MouseGetPos(1) Local $aEditPos = ControlGetPos("[ACTIVE]", "", $minimark_edit) Local $iScrollRange = _GUICtrlEdit_GetLineCount($minimark_edit) While _IsPressed("01") Local $iYCurrent = MouseGetPos(1) If $iYStart <> $iYCurrent Then Local $iNewPos = ($iYCurrent - $aEditPos[1]) * 100 / $iScrollRange _GUICtrlEdit_Scroll($minimark_edit, $iNewPos) EndIf WEnd Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc But I have a lot to learn when it comes to the low level magic in your code, your UDF is fasinating -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
Hi Nine, Would it be to much to ask to show us a trimmed down version / function just to make a label behave like a thumb, like in this example? I tried to do it myself, but i'm afraid i'm messing up inportant calls and create memory leaks ... What I understand about your code is that it makes use of _WinAPI_SetWindowSubclass to hook the RichEdit control to handle custom scrollbar behavior? $hProc is a callback function (RichEditProc), which processes scroll messages right? Local $hProc = DllCallbackRegister(__RGUI_ScrollBarProc, 'lresult', 'hwnd;uint;wparam;lparam;uint_ptr;dword_ptr') _WinAPI_SetWindowSubclass(GUICtrlGetHandle($idScroll), DllCallbackGetPtr($hProc), $idScroll, $idCtrl) Local $aScroll = [$fCall, $hProc, $iTop + 5, $iSize - 54] $mScroll[$idScroll] = $aScroll Return $idScroll This is like chinese to me. Noob asking for help here, I know (no pressure tho). -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
Dude...! This would be perfect! Tomorrow i'm gonna have a look at your udf, thanks for posting! -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
ok, thanks for letting me know -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
This is the best solution so far, i'll think i'm gonna stick with this one I'll have to extract out of the udf only what is needed, but the original udf gets credits (if that's an ok way to burrow code on this forum) -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
How did you do that? That's a huge improvement! -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
the code you provided is already helpfull for calculations, but seeing all this makes me think if it's worth all the trouble.. if _GUICtrlRichEdit_ScrollLines($hWnd, $iQlines) would have the ability to work in a non relative way, the problem would be a lot more easy! I don't get why such functionality does'nt exist.. Maybe I need to keep it basic and just save the current selection, move the cursor to the targetline and when done dragging the scroller restore the selection (like I already have code for) and to set the scroll thumb to the right place while editing -> check if cursorpos is changed in the gui loop? other alternative: somehow change transparancy of the real scrollbar -
goto specific line in rich edit control
TheAutomator replied to TheAutomator's topic in AutoIt General Help and Support
Hi everyone, thanks for the replys! Normally I reply whitin a day, but I have been sick the last few days.. junkew, Thanks, it's a good start for me to experiment with The messages you listed are the ones that should work somehow if I combine them the right way yes. pixelsearch, Thanks for the effort I want a custom colored scrollbar is the reason, not the ugly white standart one that hurts your eyes when using a dark gui (like in my project). Your code has no scrollbar at all but the code can be helpfull for calculations! I already made the graphics to fit the dark theme, but the code is still a bit buggy and not completely working: I wish i could just hide the default one but send messages to it and get from it instead of reinventing the wheel to have a custom color... I'm gonna experiment a little more with the code and see how good i can get it for general use, for now my bar just moves the cursor and resets the selection when done scrolling (it works pretty well too but you can see the cursor move when you scroll and the bar stays on the same spot when you change the text). So what I already have now: - an image for the background and one for the thumb - the ability to drag the thumb image over the background and get the result als a value between 0 and 1 according to the position dragged - some code that works a bit but not fully as i would like (like a real scrollbar) When I have a few finished scripts i'll post them here -
I'm looking for a way to programatically scroll a rich edit control to a specific line (range = first line to last line). The edit has no scrollbar and that should stay that way, the cursor and selection sould also keep unmodified, is that even possible? I know about _GUICtrlRichEdit_GetScrollPos but it works with pixels and has no clear way of finding the min and max range.. The goal here is to create a custom scrollbar, made from a label. Ideally it would also move the scrollbar thumb if I scroll the edit or change the cursor position of the edit. I have some code, but it's unfinished, it's quite a workaround but the best I can do at the moment (sorry if it looks a little dirty)... any help or better ideas would be appriciated! Contributors to this code also get credits on the code of this program in the example script section: See part of code under here, and for the graphics I'll upload a zip file ; colors const $color_text_white = 0x00ffffff const $color_text_gray = 0x00C0C0C0 const $color_element_gray = 0x606060 const $color_control_gray = 0x404040 const $color_border_gray = 0x202020 const $color_text_red = 0x006600ff const $color_text_green = 0x0000ff66 const $color_text_blue = 0x00ff6600 const $color_transparent_background = 0xff00ff ; font names const $font_handel_gothic_bt = 'handelgothic bt' const $font_lucida_console = 'lucida console' ; sound effects const $sound_start = @scriptdir & '\sounds\start.wav' const $sound_click = @scriptdir & '\sounds\click.wav' const $sound_alert = @scriptdir & '\sounds\alert.wav' const $sound_stop = @scriptdir & '\sounds\stop.wav' ; user interface images const $image_alert = @scriptdir & '\images\alert.bmp' const $image_blue = @scriptdir & '\images\blue.bmp' const $image_bold = @scriptdir & '\images\bold.bmp' const $image_case_off = @scriptdir & '\images\case_off.bmp' const $image_case_on = @scriptdir & '\images\case_on.bmp' const $image_close = @scriptdir & '\images\close.bmp' const $image_exit = @scriptdir & '\images\exit.bmp' const $image_find = @scriptdir & '\images\find.bmp' const $image_gray = @scriptdir & '\images\gray.bmp' const $image_green = @scriptdir & '\images\green.bmp' const $image_info = @scriptdir & '\images\info.bmp' const $image_install = @scriptdir & '\images\install.bmp' const $image_italic = @scriptdir & '\images\italic.bmp' const $image_link = @scriptdir & '\images\link.bmp' const $image_minimark = @scriptdir & '\images\minimark.bmp' const $image_no = @scriptdir & '\images\no.bmp' const $image_ok = @scriptdir & '\images\ok.bmp' const $image_open = @scriptdir & '\images\open.bmp' const $image_options = @scriptdir & '\images\options.bmp' const $image_red = @scriptdir & '\images\red.bmp' const $image_remove = @scriptdir & '\images\remove.bmp' const $image_replace = @scriptdir & '\images\replace.bmp' const $image_replace_all = @scriptdir & '\images\replace_all.bmp' const $image_reset = @scriptdir & '\images\reset.bmp' const $image_save = @scriptdir & '\images\save.bmp' const $image_scroll = @scriptdir & '\images\scroll.bmp' const $image_scroll_down = @scriptdir & '\images\scroll_down.bmp' const $image_scroll_up = @scriptdir & '\images\scroll_up.bmp' const $image_search = @scriptdir & '\images\search.bmp' const $image_searcher = @scriptdir & '\images\searcher.bmp' const $image_settings = @scriptdir & '\images\settings.bmp' const $image_setup = @scriptdir & '\images\setup.bmp' const $image_size = @scriptdir & '\images\size.bmp' const $image_size_down = @scriptdir & '\images\size_down.bmp' const $image_size_up = @scriptdir & '\images\size_up.bmp' const $image_sound_off = @scriptdir & '\images\sound_off.bmp' const $image_sound_on = @scriptdir & '\images\sound_on.bmp' const $image_strike = @scriptdir & '\images\strike.bmp' const $image_underline = @scriptdir & '\images\underline.bmp' const $image_white = @scriptdir & '\images\white.bmp' const $image_word_off = @scriptdir & '\images\word_off.bmp' const $image_word_on = @scriptdir & '\images\word_on.bmp' const $image_yes = @scriptdir & '\images\yes.bmp' ; intro file const $file_manual = @scriptdir & '\data\MiniMark.mnm' #notrayicon #include <guirichedit.au3> #include <guiconstants.au3> #include <winapisyswin.au3> local $x for $i = 1 to 300 $x &= $i & @CRLF Next $minimark_form = guicreate('MiniMark', 380, 380, default, default, $ws_popup, $ws_ex_layered) guisetbkcolor($color_transparent_background) $minimark_background = guictrlcreatepic($image_minimark, 0, 0, 380, 380) guictrlsetstate(default, $gui_disable) $minimark_title = guictrlcreatelabel('the title.....', 5, 5, 370, 20, bitor($ss_centerimage, $ss_center), $gui_ws_ex_parentdrag) ; use label to drag form guictrlsettip(default, 'full path') ; display full path on mouse over guictrlsetfont(default, 12, 400, 0, $font_handel_gothic_bt) guictrlsetcolor(default, $color_text_gray) guictrlsetbkcolor(default, $gui_bkcolor_transparent) $minimark_edit = _guictrlrichedit_create($minimark_form, $x, 10, 35, 270, 335, bitor($es_multiline, $es_autovscroll, $es_nohidesel), 0) ; $es_nohidesel for visible selection when using search function _guictrlrichedit_setbkcolor($minimark_edit, $color_control_gray) ;~ load_file() guiregistermsg($wm_command, wm_command) func wm_command($hwnd, $imsg, $wparam, $lparam) ; we need this becouse rich edit keeps changing to default style if $minimark_edit <> $lparam then return $gui_rundefmsg if _guictrlrichedit_istextselected($minimark_edit) then return $gui_rundefmsg if _guictrlrichedit_getfont($minimark_edit)[1] <> $font_lucida_console then _guictrlrichedit_setfont($minimark_edit, 9, $font_lucida_console) _guictrlrichedit_setcharcolor($minimark_edit, $color_text_gray) endif return $gui_rundefmsg endfunc $button_options = guictrlcreatepic($image_options, 305, 30, 70, 20) guictrlsettip(default, 'Open settings.', 'ctrl + o') $button_open = guictrlcreatepic($image_open, 305, 55, 70, 20) guictrlsettip(default, 'Open a new *.mnm file.', 'ctrl + o') $button_bold = guictrlcreatepic($image_bold, 305, 80, 70, 20) guictrlsettip(default, 'Make selection bold.', 'ctrl + b') $button_italic = guictrlcreatepic($image_italic, 305, 105, 70, 20) guictrlsettip(default, 'Make selection italic.', 'ctrl + i') $button_strike = guictrlcreatepic($image_strike, 305, 130, 70, 20) guictrlsettip(default, 'Make selection struck.', 'ctrl + t') $button_underline = guictrlcreatepic($image_underline, 305, 155, 70, 20) guictrlsettip(default, 'Make selection underlined.', 'ctrl + u') $button_red = guictrlcreatepic($image_red, 305, 180, 70, 20) guictrlsettip(default, 'Make selection red.', 'shift + ctrl + r') $button_green = guictrlcreatepic($image_green, 305, 205, 70, 20) guictrlsettip(default, 'Make selection green.', 'shift + ctrl + g') $button_blue = guictrlcreatepic($image_blue, 305, 230, 70, 20) guictrlsettip(default, 'Make selection blue.', 'shift + ctrl + b') $button_white = guictrlcreatepic($image_white, 305, 255, 70, 20) guictrlsettip(default, 'Make selection white.', 'shift + ctrl + w') $button_gray = guictrlcreatepic($image_gray, 305, 280, 70, 20) guictrlsettip(default, 'Make selection default style and gray.', 'shift + ctrl + d') $button_search = guictrlcreatepic($image_search, 305, 305, 70, 20) guictrlsettip(default, 'Find and replace text.', 'ctrl + f') $button_save = guictrlcreatepic($image_save, 305, 330, 70, 20) guictrlsettip(default, 'Save file / save file as.', 'ctrl + s / shift + ctrl + s') $button_exit = guictrlcreatepic($image_exit, 305, 355, 70, 20) guictrlsettip(default, 'Quit the program.', 'escape') $minimark_scroll_up = GUICtrlCreatePic($image_scroll_up, 290, 30, 10, 10) $minimark_scroll_thumb = GUICtrlCreatePic($image_scroll, 290, 45, 10, 20) ; scroll background: 290, 45, 10, 315 $minimark_scroll_down = GUICtrlCreatePic($image_scroll_down, 290, 365, 10, 10) _guictrlrichedit_seteventmask($minimark_edit, $enm_scrollevents) guiregistermsg($wm_notify, wm_notify) func wm_notify($hwnd, $imsg, $wparam, $lparam) local $tfilter = dllstructcreate($tagmsgfilter, $lparam) if $tfilter.hwndfrom = $minimark_edit then _guictrlrichedit_scrolllines($tfilter.hwndfrom, $tfilter.wparam ? 1 : -1) return $gui_rundefmsg endfunc _winapi_setlayeredwindowattributes($minimark_form, $color_transparent_background) ;set the transparant gui color guisetstate(@SW_SHOW, $minimark_form) #Region scrollbar $scroll_drag = False ; are we dragging the scroll button? local $scroll_selection, $scroll_new_pos ; remember cursor and selection Func check_scroll_clicked() Local $scroll_cursor = GUIGetCursorInfo($minimark_form) If _ $scroll_cursor[0] >= 290 And _ $scroll_cursor[0] <= 300 And _ $scroll_cursor[1] >= 45 And _ $scroll_cursor[1] <= 360 _ Then $scroll_drag = True $scroll_selection = _GUICtrlRichEdit_GetSel($minimark_edit) EndIf EndFunc Func scroll() Local $scroll_x = 290 ; x of $scroll control at all times Local $scroll_min_y = 55, $scroll_max_y = 350 ; range of y movement for $scroll (top of frame till bottom - height) Local $scroll_cursor = GUIGetCursorInfo($minimark_form)[1] ; get y position of cursor if $scroll_cursor < $scroll_min_y then $scroll_cursor = $scroll_min_y if $scroll_cursor > $scroll_max_y then $scroll_cursor = $scroll_max_y GUICtrlSetPos($minimark_scroll_thumb, $scroll_x, $scroll_cursor-10) ; drag scroll button within range of background bar $scroll_ratio = ($scroll_cursor - $scroll_min_y) / ($scroll_max_y - $scroll_min_y) ; calculate scroll position percentage between 0 and 1 $scroll_last = _GUICtrlRichEdit_GetLineCount($minimark_Edit) local $scroll_calculate = $scroll_ratio * $scroll_last ; calculate where to walk to local $scroll_line = _GUICtrlRichEdit_GetFirstCharPosOnLine($minimark_Edit, $scroll_calculate) _GUICtrlRichEdit_SetSel($minimark_edit, $scroll_line, $scroll_line) consolewrite(_GUICtrlRichEdit_GetLineCount($minimark_Edit) & '---' & $scroll_calculate & '---' & $scroll_ratio & @CRLF) EndFunc #endregion While 1 switch guigetmsg() case $gui_event_close soundplay($sound_stop, 1) _guictrlrichedit_destroy($minimark_edit) guidelete() exit case $GUI_EVENT_PRIMARYDOWN check_scroll_clicked() Case $GUI_EVENT_MOUSEMOVE If $scroll_drag Then scroll() Case $GUI_EVENT_PRIMARYUP if $scroll_drag Then $scroll_new_pos = _GUICtrlRichEdit_GetScrollPos($minimark_edit) _GUICtrlRichEdit_SetSel($minimark_edit, $scroll_selection[0], $scroll_selection[1]) _GUICtrlRichEdit_SetScrollPos($minimark_edit, $scroll_new_pos[0], $scroll_new_pos[1]) $scroll_drag = False EndIf case $minimark_scroll_up _guictrlrichedit_scrolllines($minimark_edit, -1) case $minimark_scroll_down _guictrlrichedit_scrolllines($minimark_edit, 1) EndSwitch WEnd scroller.zip
-
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
-
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
WildByDesign, ; System aware DPI awareness DllCall("User32.dll", "bool", "SetProcessDPIAware") ; Per-monitor V2 DPI awareness ;DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -4) I didn't even know that dll call existed before you showed me. Gonna add this to the code for sure, thanks for letting me know! BTW, about the design (spoiler alert), it's getting an update: and you're the first to get to see it :p updated code (and credits to you) coming soon! -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
Hmm.. That trick would be annoying fast with the kind of glasses I wear (wearing contacts) but okay! -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
Another quick question: is it a good idea to put your full name into the software and post it on this forum? -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
MiniMark 3 is here! Now we have: a custom (still buggy) scrollbar a search window to find and replace text (ctrl+f -> should also make a button for it that) installer is a little smaller Upcoming: user level install option (as deman... I mean, requested by argumentum) a settings window, and writing an INI file to remember some settings (like enabeling sounds or the last zoom amount) Making the gui resizable is not as easy as it seems, I tried to do that in the past with a custom gui and got very frustrated when using a borderles window that could get maximized by hitting the top of the screen but not register as maximized for example... We'll see Readers of this post, I kindly request your help! Please have a look at the custom scrollbar, and let me know if there is a way to scroll the rich edit to a specific line without moving the caret or changing the selection of the edit control, that's what i'm trying to do but the code is a little dirty. #Region scrollbar $scroll_drag = False ; are we dragging the scroll button? Func check_scroll_clicked() ; always sets $scroll_cursor variable Local $scroll_cursor = GUIGetCursorInfo($form) If _ $scroll_cursor[0] >= 300 And _ $scroll_cursor[0] <= 310 And _ $scroll_cursor[1] >= 60 And _ $scroll_cursor[1] <= 369 _ Then $scroll_drag = True EndFunc Func scroll() ; label : 300, 60, 10, 20 bar: 300, 60, 10, 310 lies visible: around 28 Local $scroll_x = 300 ; x of $scroll control at all times Local $scroll_min_y = 60, $scroll_max_y = 350 ; range of y movement for $scroll (top of frame till bottom - height) $scroll_cursor = GUIGetCursorInfo($form)[1] ; get y position of cursor if $scroll_cursor < $scroll_min_y then $scroll_cursor = $scroll_min_y if $scroll_cursor > $scroll_max_y then $scroll_cursor = $scroll_max_y GUICtrlSetPos($scroll, $scroll_x, $scroll_cursor) ; drag scroll button within range of background bar $scroll_ratio = ($scroll_cursor - $scroll_min_y) / ($scroll_max_y - $scroll_min_y) ; calculate scroll position percentage between 0 and 1 $scroll_last = _GUICtrlRichEdit_GetLineCount($Edit) If $scroll_last > 27 then $scroll_last -= 25 ; scroll to end but not over end $scroll_first = _GUICtrlRichEdit_GetNumberOfFirstVisibleLine($edit) $scroll_calculate = Int($scroll_ratio * $scroll_last) - $scroll_first ; calculate where to walk to consolewrite(_GUICtrlRichEdit_GetLineCount($Edit) & '---' & $scroll_calculate & '---' & $scroll_ratio & @CRLF) _GUICtrlRichEdit_ScrollLines($edit, $scroll_calculate) EndFunc #endregion while 1 switch guigetmsg() case $gui_event_close, $button_exit quit() case $GUI_EVENT_PRIMARYDOWN check_scroll_clicked() Case $GUI_EVENT_MOUSEMOVE If $scroll_drag Then scroll() Case $GUI_EVENT_PRIMARYUP $scroll_drag = False ... Thanks to everyone that contributed, liked and suported this project! See you soon with updates and replys -
MiniMark (a minimalistic rtf editor)
TheAutomator replied to TheAutomator's topic in AutoIt Example Scripts
argumentum, I added it to the example scripts to share it with users who like this kind of software, and to show others how to use the rich edit control and create custom GUIs. 🙂 The goal is to have a minimalistic RTF editor with files that have custom icons and open directly with MiniMark. Personally, I use it as a quick notes app for all kinds of lists (to-dos, series to binge, things to buy...) that I can just double-click and edit when needed. I'm not planning to tweak the icons, style, or add a huge amount of options becouse that would make it "maximalistic" . That being said, allowing users to choose the installation location is a great idea and will be added soon! Keep in mind that the software is designed to be compiled and installed (custom icons, fonts, and right-click menu entries). Making it portable would mean users have to manually open or drag icon-less files into the executable, which isn’t very convenient.. For testing the script as is please check the README: drag MiniMark.au3 into the MiniMark folder so it can access its files properly, then it should work. I'm doing my best to make it work as smooth as possible in my free time, but this is an open-source project in a forum full of developers who can tweak it to their liking. That doesn’t mean I’m ignoring requests, I gladly accept help with code and small handy improvements for those who want to contribute! It’s all about finding the right balance between keeping it light but good. An update is coming soon, so let’s see what I can do. 😃