mike1950r Posted May 30, 2023 Share Posted May 30, 2023 (edited) Hi, at the moment richedit @TAB size is 6 spaces. how can i set this to 4 spaces. thanks in advance. cheers mike Edited May 30, 2023 by mike1950r Link to comment Share on other sites More sharing options...
Developers Jos Posted May 30, 2023 Developers Share Posted May 30, 2023 Moved to the appropriate forum. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 30, 2023 Developers Share Posted May 30, 2023 Have you checked the helpfile for _GUICtrlRichEdit_SetParaTabStops()? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mike1950r Posted May 30, 2023 Author Share Posted May 30, 2023 Hi Jos, sorry may be i am too stupid. but i just want to change the @TAB value from actually 6 (seems to be the default) to 4. this cannot be so complicate. also where did you move to the appropriate forum? thanks for the link. cheers mike Link to comment Share on other sites More sharing options...
Developers Jos Posted May 30, 2023 Developers Share Posted May 30, 2023 I understand what you want... but since you haven't posted any script source to play with there isn't much I want to do as I am to lazy to type the basics myself. The post was made in the AutoItx support in stead of this support forum, so I moved it. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mike1950r Posted May 30, 2023 Author Share Posted May 30, 2023 i do not understand what you mean. the standard @TAB size in a richedit control is 6 spaces. we want to change this value to 4 spaces. that's all. this cannot be so complicate. cheers mike Link to comment Share on other sites More sharing options...
ioa747 Posted May 30, 2023 Share Posted May 30, 2023 I know that I know nothing Link to comment Share on other sites More sharing options...
pixelsearch Posted May 30, 2023 Share Posted May 30, 2023 @mike1950r May I suggest you adapt the following code to your script, changing the value of 14 with another value that will suit your needs. #include <SendMessage.au3> ... $g_hRichEdit = _GUICtrlRichEdit_Create(...) ... _SetTabStops($g_hRichEdit, 14) ; 14 corresponds approx. to 4 characters width (as my Scite) in this RichEdit control with this font ... Func _SetTabStops($hWnd, $iTabStops) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) ; next line _SendMessage based on _GUICtrlEdit_SetTabStops / _GUICtrlRichEdit_SetTabStops, with "uint*" instead of "struct*" of course. _SendMessage($hWnd, $EM_SETTABSTOPS, 1, $iTabStops, 0, "wparam", "uint*") EndFunc ;==>_SetTabStops Please indicate what value made it for you, as we don't have the same fonts installed on our computers. Good luck Musashi and mike1950r 2 Link to comment Share on other sites More sharing options...
mike1950r Posted May 30, 2023 Author Share Posted May 30, 2023 (edited) thanks pixelsearch, this works nearly 100%. In my window editor characters are handled like in notepad. Each character needs the same space. My font: Global Const $sGlo_WE_FontName = "Lucida Console" Global Const $iGlo_WE_FontSize = 10 Global Const $iGlo_WE_FontWeight = $FW_NORMAL WindowEditSetDefaultFont($hGlo_WE_Control, $iGlo_WE_FontSize, $sGlo_WE_FontName) Honestly, I didn't think it was complicate like this. thought it just could be like in notepad++, where you change the @TAB width in "options". cheers mike Edited May 30, 2023 by mike1950r Link to comment Share on other sites More sharing options...
mike1950r Posted May 30, 2023 Author Share Posted May 30, 2023 (edited) value of 16 fits exactly. thanks lot. cheers mike Edited May 30, 2023 by mike1950r Link to comment Share on other sites More sharing options...
Solution pixelsearch Posted May 30, 2023 Solution Share Posted May 30, 2023 Yes it matches perfectly, even after 100 characters have been typed on the precedent line (25 tabs on the following line match exactly 100 characters on preceding line). I already tested that 16 would fit, just after you indicated "Lucida Console, fontsize 10, $FW_NORMAL" As you're using a function WindowEditSetDefaultFont in this post which adds +3 to fontsize (10+3 = 13) then it's important for our readers to understand that "Lucida Console, fontsize 13, $FW_NORMAL" requires a Tab parameter of 16 for the _SetTabStops() function, so @TAB will correspond exactly to 4 characters width, in a RichEdit control using these font parameters. It's longer to explain than just modifying the value mike1950r 1 Link to comment Share on other sites More sharing options...
mike1950r Posted May 30, 2023 Author Share Posted May 30, 2023 (edited) I have modified my function like this: Func WindowEditSetDefaultFont($hWnd, $iPoints, $sName, $iTabWidth = 4) Local $hFont, $iTabStops $hFont = _WinAPI_CreateFont($iPoints + 3, 0, 0, 0, $FW_NORMAL, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, $sName) _SendMessage($hWnd, $WM_SETFONT, $hFont, True) _WinAPI_DeleteObject($hFont) $iTabStops = $iTabWidth * 4 _SendMessage($hWnd, $EM_SETTABSTOPS, 1, $iTabStops, 0, "wparam", "uint*") EndFunc ;==>WindowEditSetDefaultFont You can enter $iTabWidth value directly 4 or 6 etc. always 100% fitting. thanks lot, pixelsearch, cheers mike Edited May 30, 2023 by mike1950r pixelsearch 1 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