ds34 Posted February 10, 2010 Share Posted February 10, 2010 (edited) I create a RichEdit field $hEdit = RichText_Create($handle, 10, 30, 780, 630, $RichTextFont)'] using RichEdit.au3: func RichText_Create(ByRef $h_Gui, $x, $y, $width, $height,$fontname='COURIER NEW', $v_styles = $DEFAULT_RICHTEXT_STYLE, $v_exstyles = $WS_EX_CLIENTEDGE) Now my GUI $hMain is being resized and I need to trigger an resize of the RichEdit field. $aSize = WinGetPos($hMain) $aPosbar = ControlGetPos("", "", $hInputField) If Not @error And ControlMove($hMain, "",$hEdit, 10, 32, $aSize[2] - 30, $aPosbar[1] - 35) = 0 Then MsgBox(0, "Failure", "Edit Resizing failed") Any ideas how I could trigger an resizing of the $hEdit? Up to now I was using AutoItv 3.3.0 and did not need to do anything, upon $GUI_EVENT_RESIZED (I am using my own message handler) I performed a _WinAPI_RedrawWindow($hMain) which seems not to be enough in v3.4.0. AU3 WIndow Info returns: [CLASS:RichEdit20A; INSTANCE:1] Style: 0x54001104 ExStyle: 0x00000200 BTW: the other controls in the GUI dock properly, so it is something special about the RichEdit. Edit: corrected typo $edit vs. $hEdit Edited February 11, 2010 by ds34 Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 10, 2010 Share Posted February 10, 2010 Your posted ControlMove() has "$Edit" vice "$hEdit". Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ds34 Posted February 10, 2010 Author Share Posted February 10, 2010 Your posted ControlMove() has "$Edit" vice "$hEdit".Thanks, this is a typo in the post, the project actually uses different variable names. Always the ControlMove returns @error...I did some more searching in the forum and saw that this was posted for several versions of the early RichEdits.So I tried to use the current built-in UDF and ControlMove works over there.Starting to migrate my project to the current UDF I got stuck as well. Iam generating a colorized log and it seems that attaching portions to the hRichEdit is colorizing the whole RichEdit.I do attach the new text, select from the old text-end till the new and colorize. But this fails often, since the selection is not done properly...Also the performance of the RichEdit seems to be less than in the old RichEdit.au3s.So now I am stepping back to the old RichEdit - since it is such an old RichEdit2 object - any idea how to resize this object? Link to comment Share on other sites More sharing options...
ProgAndy Posted February 10, 2010 Share Posted February 10, 2010 (edited) It must not be ControlMove($hMain, "",$hEdit, ... but ControlMove($hEdit, "", "", ... The "new" RichEdit is slower because someone thought it would be a good idea to add Image-support to each RichEdit and not leave it as parameter or extra function. Edited February 10, 2010 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Beege Posted February 10, 2010 Share Posted February 10, 2010 I went through this problem recently. I ended up using _WinAPI_SetWindowPos() to resize richedit. _WinAPI_SetWindowPos($hEdit, 0, 10, 32, $aSize[2] - 30, $aPosbar[1] - 35, $SWP_SHOWWINDOW) Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
ds34 Posted February 11, 2010 Author Share Posted February 11, 2010 It must not be ControlMove($hMain, "",$hEdit, ... but ControlMove($hEdit, "", "", ... The "new" RichEdit is slower because someone thought it would be a good idea to add Image-support to each RichEdit and not leave it as parameter or extra function. Thanks for the hint. I tried this as well, but it returns 0 as well. I went through this problem recently. I ended up using _WinAPI_SetWindowPos() to resize richedit. _WinAPI_SetWindowPos($hEdit, 0, 10, 32, $aSize[2] - 30, $aPosbar[1] - 35, $SWP_SHOWWINDOW) Thanks, this worked perfectly! Saved my day and keeps me running ;-) Link to comment Share on other sites More sharing options...
C2i Posted July 21, 2010 Share Posted July 21, 2010 (edited) I know this is old and resolved, but I thought I might add to it for anyone else who's run into this issue and ended up here. if you use WinGetClientSize() instead of WinGetPos() so it looks like: $aSize = WinGetPos($hMain) $aPosbar = ControlGetPos("", "", $hInputField) If Not @error And ControlMove($hMain, "",$hEdit, 10, 32, $aSize[2] - 30, $aPosbar[1] - 35) = 0 Then MsgBox(0, "Failure", "Edit Resizing failed") You'll get more consistant results when dealing with different OS' and themes/border widths etc. It'll behave like it did for size when you created the richedit. #Include <WinAPI.au3> #Include <GuiRichEdit.au3> ... GUISetOnEvent($GUI_EVENT_RESIZED, "_resizeRichEdit") ... Func _resizeRichEdit() $aSize = WinGetClientSize($hMain) $aPosbar = ControlGetPos("", "", $hInputField) _WinAPI_SetWindowPos($hEdit,$HWND_TOP, 10, 32, $aSize[2] - 30, $aPosbar[1] - 35) EndFunc I'd need to see rest of the $hMain gui code to verify, but I'm guessing the $aPosbar line might be able to be removed Edited July 21, 2010 by C2i 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