How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

Scintilla CharAdded Event

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scintilla CharAdded Event

    Hi all

    in below example, i create a code editor for highlighting lua codes with scilexer.dll
    i can send standard scintilla message to it

    but i do now know how can i define CharAdded event

    is way to detect CharAdded event ??

    note (i know scintilla object plugin that published by reteset. but i strongly need to create my code editor with scilexer.dll)

    APZ Example :
    scilexer.apz

  • #2
    The only thing I could think of is using MemoryEx to subclass the Scintilla parent for Sci messages, however that would add another plugin to your collection. Subclass.Create(hWnd, function(hWnd, uMsg, wParam, lParam) end) allows you to listen for window events on a window.


    https://www.memoryex.net/mx.html
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment


    • #3
      So thanks @Imagine Programming
      good ideal
      it work currectly

      Comment


      • #4
        Originally posted by mahdishams View Post
        So thanks @Imagine Programming
        good ideal
        it work currectly
        Good to hear!
        Bas Groothedde
        Imagine Programming :: Blog

        AMS8 Plugins
        IMXLH Compiler

        Comment


        • #5
          @Imagine Programming

          i know how to get current line text with "Scintilla Object Plugin" that published by reteset.
          with below code :
          PHP Code:
          CountContent Scintilla.SendMessage("Scintilla"e_TabID"num"SCI_GETCURLINE"num"0"pstr"0); 
          but with scilexer.dll maybe above code should change little !!
          now, can you help me to get current line text in my example ??
          so thanks

          scilexer.apz

          Comment


          • #6
            Couldn't you use LuaScriptEditor.SendMessage to send the same message to your scintilla editor?
            Bas Groothedde
            Imagine Programming :: Blog

            AMS8 Plugins
            IMXLH Compiler

            Comment


            • #7

              Unfortunately no! LuaScriptEditor is my example that i created with scilexer.dll and for send message to it, i use below function :
              PHP Code:
               function LuaScriptEditor.SendMessage(HandleMessagewParamlParam)  if (not wParamthen wParam 0end if (not lParamthen lParam 0end  if (type(wParam) == "boolean"then if (wParam == falsethen wParam 0; else wParam 1end end  if (type(lParam) == "boolean"then if (lParam == falsethen lParam 0; else lParam 1end end  if (type(wParam) == "string"then wParam """..wParam.."""end   if (type(lParam) == "string"then lParam """..lParam.."""end  local SendMessage DLL.CallFunction("user32.dll""SendMessageA"Handle..","..Message..","..wParam..","..lParamDLL_RETURN_TYPE_LONGDLL_CALL_STDCALL);  return tonumber(SendMessage); end 
              as you see, above function, only return one result ! but, with scintilla object plugin, like below, sendmessage function, will return two result :
              PHP Code:
               CountContent Scintilla.SendMessage("Scintilla"e_TabID"num"SCI_GETCURLINE"num"0"pstr"0); 
              it's not bad to know that i user below function to get all of the text of scilexer editor :
              PHP Code:
               function LuaScriptEditor.GetText(Handle)  Length    LuaScriptEditor.SendMessage(HandleSCI_GETTEXT00); Buffer    Memory.Allocate(Length+1); LuaScriptEditor.SendMessage(HandleSCI_GETTEXT, (Length+1), Buffer); local Content Memory.GetString(Buffer, -1"Ascii"); Memory.Free(Buffer); return tostring(Content);  end 
              and for give current line text use below function, but below code only work currect for first line :
              PHP Code:
               function LuaScriptEditor.GetCurrentLineText(Handle)  Length    LuaScriptEditor.SendMessage(HandleSCI_GETCURLINE00); Buffer    Memory.Allocate(Length+1); LuaScriptEditor.SendMessage(HandleSCI_GETCURLINE, (Length+1), Buffer); local Content Memory.GetString(Buffer, -1"Ascii"); Memory.Free(Buffer); return tostring(Content);  end 

              Comment


              • #8
                Hi all.
                no need.
                i self resolved it.

                Comment


                • #9
                  Originally posted by mahdishams View Post
                  Hi all.
                  no need.
                  i self resolved it.
                  Would you be so kind to share your solution so that people having issues like this in the future will resolve it faster?
                  Bas Groothedde
                  Imagine Programming :: Blog

                  AMS8 Plugins
                  IMXLH Compiler

                  Comment


                  • #10

                    of course dear Imagine Programming
                    PHP Code:
                     --#################################################################################################### get text : return the all of text in the editor function LuaScriptEditor.GetText(Handle) local Length = LuaScriptEditor.SendMessage(Handle, SCI_GETTEXT, 0, 0); if (Length == 0) then return ""; end local Buffer = MemoryEx.Allocate(Length+1); LuaScriptEditor.SendMessage(Handle, SCI_GETTEXT, (Length+1), Buffer); local Content = MemoryEx.String(Buffer, -1, MEMEX_ASCII); MemoryEx.Free(Buffer); return tostring(Content); end 
                    PHP Code:
                     --#################################################################################################### get line text : return the specific line number in the editor function LuaScriptEditor.GetLineText(Handle, LineNumber) local Length = LuaScriptEditor.SendMessage(Handle, SCI_LINELENGTH, LineNumber, 0); if (Length == 0) then return ""; end local Buffer = MemoryEx.Allocate(Length); LuaScriptEditor.SendMessage(Handle, SCI_GETLINE, LineNumber, Buffer); local Content = MemoryEx.String(Buffer, -1, MEMEX_ASCII); MemoryEx.Free(Buffer); return tostring(Content); end 
                    note : line number star at 0

                    Comment

                    Working...
                    X