TheDcoder

[Sloved] Set Resizing for a RichEdit control?

2 posts in this topic

#1 ·  Posted (edited)

Hello everyone :), I want to set the resizing of a RichEdit control in a GUI, Unfortunately GUICtrlSetResizing only accepts IDs not Handles :(

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>

$hGUI = GUICreate("Test GUI", 500, 300, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_VISIBLE))
$hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 0, 0, 500, 300)

; GUICtrlSetResizing($hRichEdit, $GUI_DOCKAUTO) ; Don't even think of trying this

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

I want the RichEdit to always fill the whole window, Thanks in Advance :)

 

TD :)

Edited by TheDcoder
Marked As Sloved

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites



I figured it out, Thanks to Mat

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>

Global $hGUI = GUICreate("Test GUI", 500, 300, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_VISIBLE))
Global $hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 0, 0, 500, 300)

; GUICtrlSetResizing($hRichEdit, $GUI_DOCKAUTO) ; Don't even think of trying this

GUIRegisterMsg($WM_SIZE, "WM_SIZE") ; Register the function

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    Local $iWidth = _WinAPI_LoWord($lParam)
    Local $iHeight = _WinAPI_HiWord($lParam)

    _WinAPI_MoveWindow($hRichEdit, 2, 2, $iWidth - 4, $iHeight - 4)

    Return 0
EndFunc   ;==>WM_SIZE, Thanks Mat :)

TD :D


Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • AndreyS
      By AndreyS
      Please tell me, who knows how to apply and cancel styles in RTF?
      The following code does not work:
      #include <GuiRichEdit.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("RichEdit Style", 500, 500, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "Test", 20,40,460,400) GUISetState(@SW_SHOW, $hGUI) Sleep(3000) GUICtrlSetStyle($hRichEdit, $ES_RIGHT) Sleep(3000) GUICtrlSetStyle($hRichEdit, -1) Sleep(3000) Thanks!
    • kashamalasha
      By kashamalasha
      Hi everybody.
      Could you tell me is there any UDF that can help to highlight syntax in the _GUICtrlRichEdit element on the fly?
      Is it possible to implement this feature in script in simple way using some UDF or something, instead of writing thousand of strings manually?
      Thanks in advance.
    • qwert
      By qwert
      I've been working with RichEdits and have come upon the very useful RESH UDF.  But I baffled by one statement in the example's _LoadFile() function:
      _GUICtrlRichEdit_ReplaceText($hRichEdit, '') Can someone explain this "non-replace"?  Here's the context:

       
       
    • InunoTaishou
      By InunoTaishou
      I think RichEdit has been my favorite thing I've ever discovered on AutoIt lol. In my quest to add in more html tags to my _StringToRichEditArray I needed a way to do href! There was an example I found that I followed but it didn't format correctly and didn't work 100% but it gave me a good base. Think I'll tackle inserting an image next, not looking forward to that. If anyone has an idea on how to do it let me know.
      Known issues (these will cause the hyperlink to lose the +li attribute after the RichEdit is updated):
      The hyperlink and friendly text are appended/inserted (directly adjacent to a non whitespace) but the hyperlink is not a valid hyperlink. Changing the char color for the control causes the hyperlink to lose it's hyperlink color (the light blue). Fix for Issue 1:
      Use the full URL for the hyperlink (https://www.autoitscript.com/site/ instead of www.autoitscript.com/site) Use any hyperlink with any friendly text that does not have www at the beginning (Hyperlink: www.google.com, Friendly Text: google.com) Use any hyperlink with any, or no, friendly text, but have a whitespace to the left of the hyperlink. Fix for Issue 2:
      I have no fix. Updated RichEdit Hyperlink.au3
      Demo
      Original Post, outdated: Had a problem with inserting/appending hyperlinks that pointed to the local computer. (C:\Windows\)
       
       
    • InunoTaishou
      By InunoTaishou
      You can now use your favorite html tags in a richedit control!
      Supports:
      <b></b> (bold) <i></i> (italic) <s></s> (strike) <u></u> (underline) <color=#nnnnnn></color> (color text) <color=0xnnnnn></color> (color text) <bkcolor=#nnnnnn></color> (color background text) <bkcolor=0xnnnnnn></color> (color background text) <font name="Font name" size=n></font> (Font name is the only one that has to have quotes around it. They can be double quotes or single, it doesn't matter. color, bkcolor, and size can also use quotes but they're optional)
      Does not support (but I may add later)
      <align> <a href=""> <img>
      ; Functions _GUICtrlRichEdit_AppendHtmlText _StringToRichEditArray __GetArrayFromRegex __GetRichEditAttrFromChar __GUICtrlRichEdit_AppendTextColored __GUICtrlRichEdit_SetTextColor (I'm sure someone can come up with some better names for this lol)
      You can use a formatted (<color=0xNNNNNN>Formatted</color>) or non-formatted (Non-formatted) string with calling _GUICtrlRichEdit_AppendHtmlText and _StringToRichEditArray. _StringToRichEditArray will just set the attributes, font name, font size, and colors to the current attributes of the RichEdit Control (At least it should... RichEdit can be picky about setting the font and char attributes correctly....).
      Calling _StringToRichEditArray will return a 2d array with n amount of rows.
      [n][0] - String [n][1] - Font name for the [0] string. [n][2] - Font size for the [0] string. [n][3] - Character attributes for the [0] string. [n][4] - Text color for the [0] string. [n][5] - Back color for the [0] string. It seems I was too hasty in my release and this still wasn't working 100% . I guess I'll try to work on it tomorrow and see if I can get it working  the way tags are supposed to work. It's not a complete waste, it's close  but not perfect and I know why.
      Formatted RichEdit Array V2.rar
      Html Richedit.rar