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

    • tcox8
      By tcox8
      Hello all,
      Long story short: I am updating a program I created many years ago for our Help Desk. I haven't used AutoIt in a while so I downloaded it again. Of course there were several script breaking changes so I opted to download an older version of AutoIt (3.3.8.1) which worked. However when downloading the full Scite it produces the attached error when trying to compile my script. I need the full version of Scite to compile with options. Is it possible to download older versions of Scite or is there an easy fix for this issue? I have attempted reinstalling, uninstalling/rebooting/reinstalling to no avail.
      Thanks!

    • JohnNash
      By JohnNash
      Weird story. Been using Autoit for more than a year now. But recently moved to a new machine, so did a fresh install, and suddenly I saw menus I never saw before in the editor.
      For example, I Always used to have: Tools>Compile and then it would compile my au3 code. Now, the tools menu has a lot of options but after pressing Compile it goes to a whole new screen specifically for au3 code to select more options, also it debugs my code, which prevents compiling if badly coded.
      Of course this is fine, but I would really like to recompile some old crappy code I wrote, regardless of the mistakes that are still in there, also I am really used to the old setup I had,
      so kind of not done, but how do i get this 'bad'  configuration back? Does it have to do with the au3.properties file? What should I do with it....
      Thanks
       
    • Anas
      By Anas
      Hi,
      After I updated SciTE to v3.6.6, whenever I write a fold-able line (e.g. Do, For, While) SciTE will unfold all the code below it by it self.
      Before writing "While" at the beginning of the script:

       
      after writing While:

       
      Is this normal? if yes, can I stop it?
    • mLipok
      By mLipok
      In SciTE when I press CTRL+SHIFT+W then there is inserted a scpecial sign "ETB" 
      What it is ?

      I want also to ask whether this feature is used / useful ?
      I ask because I want to change the keyboard shortcut (in my own config)
    • Anas
      By Anas
      Hi,
      Is it possible to make Scite fold functions within regions?