Jump to content

Problem with GUIRichEdit


Recommended Posts

Hi @all

I have a question ,when i write _GUICtrlRichEdit_FindTextEx then then the error comes "AutoIt v3 Script doesn't rund anymore" (I hope its translated right) I'm using The RichEdit udf of Prog@ndy and Co.

The code,which I have in this moment

#include <GUIRichEdit.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GuiEdit.au3>
#include <Misc.au3>

HotKeySet("{TAB}","_func_tabulator")
#region - GUI Create
Global $hGUI = GUICreate('',1100,700,-1,-1,$WS_MINIMIZEBOX+ $WS_CAPTION+ $WS_POPUP+ $WS_SYSMENU + $WS_MAXIMIZEBOX)
$hRichEdit = _GUICtrlRichEdit_Create($hGUI,0,0,1100,700,BitOR($ES_WANTRETURN, $WS_HSCROLL, $ES_SUNKEN, $ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lResult = _SendMessage($hRichEdit, $EM_SETEVENTMASK, 0, $ENM_KEYEVENTS)
GUISETSTATE(@SW_SHOW)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
#endregion

#region - GUI SelectLoop
While 1
    $pos = WinGetPos($hGUI)
    $c = ControlGetPos($hGUI,"",$hRichEdit)
    If $pos[2] <> $c[2] or $pos[3] <> $c[3] Then
        ControlMove($hGUI,"",$hRichEdit,0,0,$pos[2],$pos[3])
    Endif
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
#endregion

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hRichEdit

            Select
            Case $iCode = $EN_MSGFILTER
                    Local $tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $ilParam)
                    If DllStructGetData($tMsgFilter, 4) = $WM_KEYDOWN Then
                        $hTxt = _GUICtrlRichEdit_GetText($hRichEdit)
                        $hLines = _GUICtrlRichEdit_GetLineCount($hRichEdit)
                        If StringInStr($hTxt,"<?php") Then
                            $hPost = _GUICtrlRichEdit_FindTextEx($hRichEdit,"<?php",0,$hLines)
                        Endif
                    EndIf
            EndSelect
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _func_tabulator()
    $txt = _GUICtrlRichEdit_GetText($hRichEdit)
    $replace_txt = $txt & "    "
    _GUICtrlRichEdit_InsertText($hRichEdit,"        ")
EndFunc

Can anybody help me to give "<?php" another color ?

thanks for help

mfg. SimonMany of my answers are translated of google, because I'am from Germany

Link to comment
Share on other sites

I've never used the udf, so this is just a guess. If the last parameter in that function is last line then it should be $hLines - 1?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I've never used the udf, so this is just a guess. If the last parameter in that function is last line then it should be $hLines - 1?

The problem is the same , I've tried many things but ist gives me the same error the "Autoit v3 Script doesnt run any more"

$hPost = _GUICtrlRichEdit_FindTextEx($hRichEdit,"<?php",1,-1,1)

mfg. SimonMany of my answers are translated of google, because I'am from Germany

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...