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

    • 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.
       
    • Jos
      By Jos
      Merged the SciTE 3.7.3 source into our version and several other changes and fixes to the supporting utilities.
      Enjoy,
      Jos
      Addition/Changes/Fixes in the current installer:
      -------------------------------------------------------------------------------------------------- 24-2-2017 *** Merged the SciTE v 3.7.3 by Neil Hodgson with our own version of SciTE. (Jos) *** Updated AutoIt3Wrapper v17.224.935.0 (Jos)     - 16.612.1119.1 Fixed #AutoIt3Wrapper_Run_Stop_OnError=N, avoiding to stop even when No or not  specified.     - 16.612.1119.2 Fixed #AutoIt3Wrapper_Run_Stop_OnError=N, avoiding to stop even when No or not  specified.     - 16.612.1119.3 Added warning for #AutoIt3Wrapper_UseX64 in case #pragma(out,..)  is used. *** Updated Au3Stripper v17.224.935.0 (Jos)     - 16.612.1119.1 Fixed issue which sometimes was stripping a global const incorrectly     - 16.612.1119.2 Fixed /maxiterations parameter not recognised     - 16.612.1119.3 Fixed increased the max #Au3Stripper_Ignore_Variables to 500 and for #Au3Stripper_Ignore_Funcs to 200     - 16.612.1119.4 Fixed regression introduced in 16.612.1119.1 *** Updated SciTEConfig v17.224.935.0 (Jos)     - 16.306.1119.1 ... *** Updated Tidy v17.224.935.0 (Jos)     - 16.612.1119.1: Fixed Sort_Func function bug when the source contains a BOM. *** Updated CodewiZard v1.5.4.0 (Cyberyeye)     - Fix Icon Ressource Number for Messagebox Tab & ToolTip Tab     - Check/Fix missing includes using AutoIt3Wrapper_Add_Constants=y     - Added Opt("MustDeclareVars", 1) to fix undeclared variables     - Replaced msgbox() magic number by constant name     - Added GUISetIcon var (au3.ico)     - Removed unusefull old AutoIt3Wrapper directive *** Updated Abbreviations (mLipok)     - Updated au3abbrev.properties and helpfile page. --------------------------------------------------------------------------------------------------
      ==> ScitillaHistory page containing all SciTE-Scintilla updates.
      ==> Visit the SciTE4AutoIt3 Download page for the latest versions
      ==> Check  the online documentation for an overview of all extra's you get with this installer.
       
    • TheDcoder
      By TheDcoder
      Hello, I just noticed something strange... all of the "Tools" in SciTE's tools menu have disappeared!

      I am sure that I saw them yesterday... don't know what happened today ! I am using SciTE v3.6.6 which I believe is the latest version... Thanks in Advance!