kcvinu

Scintilla Editor experiment

17 posts in this topic

#1 ·  Posted (edited)

Hi all,

I have got a code snippet from Scintilla's website.  The code is for creating a scintilla control in visual basic. I have altered it and did some experiment with it in AutoIt. After some failed attempts, i got succeeded in creating a simple scintilla cotrol in my gui. That experiement raises a lot of questions in my mind. Some of them are i am asking.

1. So we are cretaing scintilla as a child window ?. I thought that it is a control. 

2. No.. not any more. This is my code. I am seeking guidance and advices to learn more about this. Thanks in advance.

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>

Local $h__MainGUI = GUICreate("Window", 500, 400, -1, -1)
GUISetState()
Local $h__THisGUI = WinGetHandle($h__MainGUI)
Local Const $SCI_START = 2000
Local Const $SCI_ADDTEXT = $SCI_START + 1
Local Const $SCI_SETSELBACK = $SCI_START + 68

Local $h__sciDLL = _WinAPI_LoadLibrary("E:\2014 Softwares\KE editor\SciLexer.dll")
Local $h__sciWnd = _WinAPI_CreateWindowEx($WS_EX_CLIENTEDGE, "Scintilla", "TEST",BitOR($WS_CHILD, $WS_VISIBLE),0,0,480,380,$h__THisGUI,0)
_SendMessageA($h__sciWnd, $SCI_SETSELBACK, 1 )
_SendMessageA($h__sciWnd, $SCI_ADDTEXT, 16, "This is Vinod")

While 1
    $hMsg = GUIGetMsg()
    Switch $hMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Edited by kcvinu

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Au3Info can tell you that.

 the dll internally first register an Scintilla class using RegisterClassExW then use RegisterClassExA to  create the window\control.

Saludos

Edited by Danyfirex
1 person likes this

Share this post


Link to post
Share on other sites

@Danyfirex Thanks. Let me check it with Au3Info. :)

 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Yes. And we can treat it as our own control in that GUI. 

Now, i am reading the documentation.

 


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites

Yes Look:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>
Global Const $__EDITCONSTANT_WM_SETTEXT = 0x000C
Local $h__MainGUI = GUICreate("Window", 500, 400, -1, -1)
GUISetState()
Local $h__THisGUI = WinGetHandle($h__MainGUI)
Local Const $SCI_START = 2000
Local Const $SCI_ADDTEXT = $SCI_START + 1
Local Const $SCI_SETSELBACK = $SCI_START + 68

Local $h__sciDLL = _WinAPI_LoadLibrary("SciLexer.dll")
Local $h__sciWnd = _WinAPI_CreateWindowEx($WS_EX_CLIENTEDGE, "Scintilla", "TEST",BitOR($WS_CHILD, $WS_VISIBLE),0,0,480,380,$h__THisGUI,0)
_SendMessageA($h__sciWnd, $SCI_SETSELBACK, 1 )
_SendMessageA($h__sciWnd, $SCI_ADDTEXT, 16, "This is Vinod")

_GUICtrlEdit_SetText($h__sciWnd,"Hola Mundo. AutoIt Rocks")

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

    EndSwitch
WEnd

Func _GUICtrlEdit_SetText($hWnd, $sText)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)

    _SendMessage($hWnd, $__EDITCONSTANT_WM_SETTEXT, 0, $sText, 0, "wparam", "str")
EndFunc   ;==>_GUICtrlEdit_SetText

Saludos

1 person likes this

Share this post


Link to post
Share on other sites

Documentation says that to use WM_NOTIFY message to work with scinitlla control. They gave an example c++ code to do it. But i just check it with an ordianry WM_COMMAND function in GUIRegisterMsg. As if it s an edit control in my gui. It worked, but it gave output twice to me. I don't know why.


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites

@Danyfirex Please tell me about the const $__EDITCONSTANT_WM_SETTEXT. help file says that it is "Msg to send to control (Number). And in the example they used $WM_SYSCOMMAND. I am confused a little.


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites

Documentation says that to use WM_NOTIFY message to work with scinitlla control. They gave an example c++ code to do it. But i just check it with an ordianry WM_COMMAND function in GUIRegisterMsg. As if it s an edit control in my gui. It worked, but it gave output twice to me. I don't know why.

Show your code :)

@Danyfirex Please tell me about the const $__EDITCONSTANT_WM_SETTEXT. help file says that it is "Msg to send to control (Number). And in the example they used $WM_SYSCOMMAND. I am confused a little.

It's just for send text to a control https://msdn.microsoft.com/en-us/library/windows/desktop/ms632644(v=vs.85).aspx

Saludos

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Pretty sure somebody else has create an editor in AutoIt using Scintilla and posted about it in the forum. Maybe look for that.

Also ISN AutoIt Studio is based on Scintilla.

Jos 

Edited by Jos
1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

@Jos can you tell me witch command use SciTE when show this kind of tooltip with scroll. (I'm don want to reverse SciTE :S)  it makes my screen driver  fails...

8g9WAVe.png

 

 

 

Saludos

 

Edited by Danyfirex

Share this post


Link to post
Share on other sites

No no. I mean what it use internally. maybe how to reproduce that using sendmessage. then I will look inside to check that message because I think It should be a predefined message.

 

Saludos

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

That is the same message, but obviously there need to be multiple options in au3.api for it to trigger that version.

Jos 


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

    • SorryButImaNewbie
      By SorryButImaNewbie
      Hello,
      I try to add a new UDF to my AutoIT library, and it seems I fail. I started to work following the insturctions found on the wiki . 
      I made an extra folder just next to my AutoIT folder, called ExtraUDF, and copied the file CUIAutomation2.au3 in it (I try to use this UDF for automating a program) then I run sciteconfig, set this folder up as User Include Folder, applied the changes, then run the calltip manager and got a msg when I tried to parse it. I attach a few pictures for better present the problem.
      I think I miss something here, should i put anything else on the ExtraUDF folder? I dont think that the CallTip manager added the udf to scite, If I try to run it i get a msg saying that I Scite cant open the include file and naturally after that, It can't use the functions called from it.
      Thank you for your help and insight as always! Please ask, if anything is fuzzy about the problem
       





    • IamKJ
      By IamKJ
      Basically I'm trying to figure out what would be the most efficient means of making multiple use buttons.  What I'd like is to be able to click a button and pop up a msgbox to gather some info, or two message boxes, but upon entering that info and the msgbox dialogue being over, it'll then switch to a different function.  I was thinking of using 1/0 to designate which is true or not, but not sure if that'd be the most efficient way.  Still very new to coding, and autoit, any help would be great!
    • Yash91
      By Yash91
      Hi Experts,
      I want to integrate AutoIT with Eclipse to write my code in java for automating the desktop base application, i have integrate jacob 1.18 and verify the dll's also but i am getting How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51 issue.
      I am using 32 bit windows xp with java 1.6 version.
      Java 1.7 is unsupported in 32 bit windows xp. is there any solution for the same.
    • AndyS01
      By AndyS01
      I recently installed AutoIt and SciTE4AutoIT and when I edit a file and change the editor's screen position and size, then exit and edit the file again, the editor reverts to the original GUI metrics. My laptop is running Windows 7 Professional, 64 bit OS.   I have a laptop with the same software, but 32 bit OS and it  works OK.
    • YashShrivastava
      By YashShrivastava
      Hi Experts,
      I am getting error: _ExcelBookOpen() undefined function in auto IT scite whenever i execute any program using functions.
      i defined the functions name also but this error is not getting resolved.
      _ExcelBookOpen(): undefined function
      _ExcelReadCell():undefined function
      require your inputs to fix this issue. I'm going through the forums and examples, but can't find anything and follow the suggestions but this issue hasn't got resolved.