Jump to content

Scintilla Editor experiment


 Share

Recommended Posts

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
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

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)

 

Link to comment
Share on other sites

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

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

 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

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)

 

Link to comment
Share on other sites

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

Now, i am reading the documentation.

 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

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)

 

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

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

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

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)

 

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

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

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)

 

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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Link to comment
Share on other sites

  • Developers

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

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

×
×
  • Create New...