AutoHotkey Community

It is currently May 26th, 2012, 8:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 240 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 16  Next

Do you want HiEdit internaly
Yes
No, I like Edit control
Other (please explain)
You may select 1 option

View results
Author Message
 Post subject: WOO HOO!!!
PostPosted: April 26th, 2008, 8:54 am 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Hey majkinetor.

Kudos on your wrapper.

Here are some images that show the implementation of the HiEdit control in my ARMbasic IDE for Coridium Corp's MicroController Product Line.

I blended the guidance that I took from corrupt's cRichEdit control and was able to embed a couple of the HiEdit Controls onto a AHK tab control.

On the first tab, I disabled the HiEdit tabs and am using it as a normal edit control, that gives syntax highlighting.

On the 2nd AHK tab, I have a tab'd HiEdit control that allows the user to look at the toolchain dialogue in the various tabs.

I am posting, in addition to saying thanks for the work, to ask a question.

With the control being on a couple of tabs, when I switch tabs, I am seeing where the sub-controls on the tabs aren't being redrawn properly. Is there a message that I can send to the control to get it to redraw all of it's elements?

Here is a pic of the ide with the console tab selected - the IDE is docked inside of the editor:
Image

Here is a pic showing the docked IDE looking at the preprocessor debug dialog:
Image

Here is a pic showing an undocked IDE with the issue I am seeing with the elements not being re-drawn properly:
Image

Here is a pic showing what the same display should look like (when I resize the container, I have the gui destroyed and re-created which results in the proper display of the sub-controls on the HiEdit control).
Image

And here is another pic looking at the preprocessed source before it gets handed off to the compiler. Basically looking at the 2nd tab on the 2nd tab. Embedded controls rule...:
Image

At any rate, please review and advise if you have any suggestions for programmatically forcing a redraw on AHK tab control selection.

Thank you!

-t

p.s. for anyone else wanting to embed a HiEdit onto a set of AHK tab controls, here' s some code showing how I did it:
Code:
...
   Gui, Add, Tab2, x%localx% y%localy% w%localw% h%localh% Bottom, Console|ToolChain Dialog
      gui tab, 1
...
      local := toolsw-60
      local2 := toolsh-92

      Gui, Add, Picture, x15 y37 w%local% h%local2% HwndConsoleParent ; for adding Control to tabs
      
         Console := HE_Add(ConsoleParent,0,0,local,local2, "VSCROLL HILIGHT", A_ScriptDir "\Resources\HiEdit.dll")
         colors=
         (
            Text            = 0x0
            Back            = 0xc5c5c5
            SelText            = 0xFFFFFF
            ActSelBack         = 0xc56a31
            InSelBack         = 0xAAAAAA
            LineNumber         = 0x0
            SelBarBack         = 0x999999
            NonPrintableBack   = 0xFFFFFF
            Number            = 0x0
         )
         HE_SetColors(Console, colors)
         HE_LineNumbersBar(Console, "show",0,10)
         fStyle := "s11"
         fFace  := "Monospac821 BT"
         HE_SetFont( Console, fStyle "," fFace)
         HE_SetKeywordFile( A_ScriptDir "\Resources\ARMbasic.syn")
...
      gui tab, 2
      Gui, Add, Picture, x10 y10 w%local% h%local2% HwndToolChainDialogParent
      
      ToolChainDialog := HE_Add(ToolChainDialogParent,0,0,local,local2, "HSCROLL VSCROLL HILIGHT TABBEDHRZSB FILECHANGEALERT", A_ScriptDir "\Resources\HiEdit.dll")
      colors=
      (
         Text            = 0x0
         Back            = 0xc5c5c5
         SelText            = 0xFFFFFF
         ActSelBack         = 0xc56a31
         InSelBack         = 0xAAAAAA
         LineNumber         = 0x0
         SelBarBack         = 0x999999
         NonPrintableBack   = 0xFFFFFF
         Number            = 0x0
      )
      HE_SetColors(ToolChainDialog, colors)
      HE_LineNumbersBar(ToolChainDialog)
      fStyle := "s8"
      fFace  := "Monospac821 BT"
      HE_SetFont( ToolChainDialog, fStyle "," fFace)
      HE_SetKeywordFile( A_ScriptDir "\Resources\ARMbasic.syn")

      HE_OpenFile(ToolChainDialog, "C:\Program Files\Coridium\temp\__tgthex.tmp")
      HE_OpenFile(ToolChainDialog, "C:\Program Files\Coridium\temp\__cmperr.tmp")
      HE_OpenFile(ToolChainDialog, "C:\Program Files\Coridium\temp\__temp.bas")
      HE_OpenFile(ToolChainDialog, "C:\Program Files\Coridium\temp\__temp.bpp")
      HE_OpenFile(ToolChainDialog, "C:\Program Files\Coridium\temp\__cppout.tmp")
...

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2008, 7:17 pm 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Also, the .rar archive for the toolset has a typo in the library file HiEdit.ahk. On line 280, the word ...length is mis-spelled.

Quote:
;----------------------------------------------------------------------------------------------------
; Function: GetTextLenght
; Returns the length of text, in characters.
;
HE_GetTextLenght(hEdit) {
static WM_GETTEXTLENGTH=14
SendMessage, WM_GETTEXTLENGTH, 0, 0,, ahk_id %hEdit%
Return ErrorLevel
}

;----------------------------------------------------------------------------------------------------


And there appear to be 3 other references within the lib file where it is also mis-spelled.?.

This messed with da noodle in me noggin for a bit, as the guidance on the ahk.net site for the control shows it spelled properly... :)

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 27th, 2008, 8:00 pm 
I thought i fixed that typo....

Quote:
At any rate, please review and advise if you have any suggestions for programmatically forcing a redraw on AHK tab control selection.

Try Redraw function in ComboX module. if you have problems with redraws.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 28th, 2008, 10:38 pm 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
Hi Majkinetor.

Thanks for the suggestion.

We (well, honestly, not even me, just akyprian) have figured out what is going on. Take a peek at the 4th post+ on here.

It seems to be related to a line of code in your wrapper.

I implemented the fix he suggested, and it surely does resolve the problem.

Just wanted to let you know, in case there wasn't a good reason that the wrapper included the offending syntax. If it was indeed intentional, I'd be interested in knowing the reasoning, so that I can learn yet some more.

Again, thanks.

Take care.

-t

_________________
When replying, please feel free to address me as Tod. My AHK.net site...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 29th, 2008, 9:14 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Quote:
It seems to be related to a line of code in your wrapper.

There are some redrawing problems but with other controls I wrapped, i didn't encounter them with HiEdit.

I will see what i can do with your problem.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 20th, 2008, 7:02 am 
I found a bug.

When HiEdit is open but not the active window and you press ctrl+f HiEdit will open a search box (in the background) and the ctrl+f doesn't get send to the active window.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 17th, 2008, 2:22 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Looks like the following function returns always the previous line rather than current or the number given.

As far as I understand "Return ErrorLevel +1" would fix it.

Can you confirm and fix?

Code:
HE_LineFromChar(hEdit, ich) {
   static EM_LINEFROMCHAR=201                                       
      SendMessage, EM_LINEFROMCHAR, ich, 0,, ahk_id %hEdit%                                       
   Return ErrorLevel                                       
}

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 17th, 2008, 2:37 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
it's probably zero based.

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 17th, 2008, 3:27 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
It looks like it is 0 based.

Another problem is HE_GetLine(hEdit)
When line is only 1 character, it returns empty string.

Can anybody confirm?

Is it a bug? How to get around?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 7th, 2008, 4:31 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
If you go through the HiEdit.inc document that is included with the HiEdit download, you would quickly determine that there are quite a few of routines that could be added to the HiEdit library. Unfortunately most of the "new" routines would go unused because they are not needed, there are alternative commands, etc. But and however, there are a few unused commands that have value.

Using the current library syntax (for the most part), I've written a few functions that might be useful:

Code:
;-------------------------------------------------------------------------------
; Function: HE_GetModify
;
;           Gets the state of the modification flag for the HiEdit control. The
;           flag indicates whether the contents of the control have been
;           modified.
;
;
; Parameters:
;
;           idx - Index of the file. -1 for the current file (default)
;
;
; Returns:
;
;           TRUE if the content of HiEdit control has been modified, FALSE
;           otherwise.
;
;
HE_GetModify(hEdit,idx=-1)
    {
    Static EM_GETMODIFY:=0xB8
    SendMessage EM_GETMODIFY,0,idx,,ahk_id %hEdit%
    Return ErrorLevel
    }



;-------------------------------------------------------------------------------
; Function: HE_SetModify
;
;           Sets or clears the modification flag for the current file. The
;           modification flag indicates whether the text within the control has
;           been modified.
;
;
; Parameters:
;
;           ModifyFlag - Set to TRUE to set the modification flag.  Set to FALSE
;               to clear the modification flag.
;
;
; Returns:
;
;           (None)
;
;
HE_SetModify(hEdit,ModifyFlag)
    {
    Static EM_SETMODIFY:=0xB9
    SendMessage EM_SETMODIFY,ModifyFlag,0,,ahk_id %hEdit%
    Return
    }



;-------------------------------------------------------------------------------
; Function: HE_EmptyUndoBuffer
;
;           Resets the undo flag in the HiEdit control for the current file.
;
;
; Returns:
;
;           (None)
;
;
HE_EmptyUndoBuffer(hEdit)
    {
    Static EM_EMPTYUNDOBUFFER:=0xCD
    SendMessage EM_EMPTYUNDOBUFFER,0,0,,ahk_id %hEdit%
    Return
    }



;-------------------------------------------------------------------------------
; Function: HE_Scroll
;
;           Scrolls the text vertically in the HiEdit control for the current
;           file.
;
;
; Parameters:
;
;           Pages - The number of pages to scroll.  Use a negative number to
;               scroll up and a positive number to scroll down.
;
;           Lines - The number of lines to scroll.  Use a negative number to
;               scroll up and a positive number to scroll down.
;
;
; Returns:
;
;           {The following information extracted from HiEdit.inc}
;           The number of lines that the command scrolls. The number returned
;           may not be the same as the actual number of lines scrolled if the
;           scrolling moves to the beginning or the end of the text.
;
;
; Remarks:
;
;           This message does not move the caret.
;
;
; Programming Notes:
;
;           0x7FFFFFFF=2147483647=largest possible 32-bit signed integer value
;
;
; Observations:
;
;           Despite the documentation, the return value for the message always
;           reflects the request, not necessarily the actual number of lines
;           that were scrolled.  Example: If a request to scroll down 25 lines
;           is made, 25 is returned even if the control is already scrolled down
;           to the bottom of the document. [Bug?]
;
;
HE_Scroll(hEdit,Pages=0,Lines=0)
    {
    Static EM_SCROLL:=0xB5
          ,SB_LINEDOWN:=0x1  ;-- Scroll down one line
          ,SB_LINEUP:=0x0    ;-- Scroll up one line
          ,SB_PAGEDOWN:=0x3  ;-- Scroll down one page
          ,SB_PAGEUP:=0x2    ;-- Scroll up one page


    ;-- Initialize
    l_ScrollLineCount:=0


    ;-- Pages
    if Pages
        {
        l_nScroll:=SB_PAGEDOWN
        if Pages<0
            {
            l_nScroll:=SB_PAGEUP
            Pages:=Abs(Pages)
            }
   
        loop %Pages%
            {
            SendMessage EM_SCROLL,l_nScroll,0,,ahk_id %hEdit%
            l_ErrorLevel:=ErrorLevel


            ;-- Negative number?
            if l_ErrorLevel>0x7FFFFFFF
                l_ErrorLevel:=-(~l_ErrorLevel)-1  ;-- Convert to signed integer


            ;-- Add to the total
            l_ScrollLineCount:=l_ScrollLineCount+l_ErrorLevel
            }
        }


    ;-- Lines
    if Lines
        {
        l_nScroll:=SB_LINEDOWN
        if Lines<0
            {
            l_nScroll:=SB_LINEUP
            Lines:=Abs(Lines)
            }
   
        loop %Lines%
            {
            SendMessage EM_SCROLL,l_nScroll,0,,ahk_id %hEdit%
            l_ErrorLevel:=ErrorLevel


            ;-- Negative number?
            if l_ErrorLevel>0x7FFFFFFF
                l_ErrorLevel:=-(~l_ErrorLevel)-1  ;-- Convert to signed integer


            ;-- Add to the total
            l_ScrollLineCount:=l_ScrollLineCount+l_ErrorLevel
            }
        }


    ;-- Return number of lines scrolled
    Return l_ScrollLineCount
    }



;-------------------------------------------------------------------------------
; Function: HE_LineScroll
;
;           Scrolls the text in the HiEdit control for the current file.
;
;
; Parameters:
;
;           xScroll - The number of characters to scroll horizontally.  Use a
;               negative number to scroll to the left and a positive number to
;               scroll to the right.
;
;           yScroll - The number of lines to scroll vertically.  Use a negative
;               number to scroll up and a positive number to scroll down.
;
;
; Returns:
;
;           (None)
;
;
; Remarks:
;
;           This message does not move the caret.
;
;           {The following information extracted from HiEdit.inc}
;           The HiEdit control does not scroll vertically past the last line of
;           text in the control. If the current line plus the number of lines
;           specified by the yScroll parameter exceeds the total number of lines
;           in the HiEdit control, the value is adjusted so that the last line
;           of the HiEdit control is scrolled to the top of the HiEdit control
;           window.
;
;           The EM_LINESCROLL message can be used to scroll horizontally past
;           the last character of any line.
;
;
HE_LineScroll(hEdit,xScroll=0,yScroll=0)
    {
    Static EM_LINESCROLL:=0xB6
    SendMessage EM_LINESCROLL,xScroll,yScroll,,ahk_id %hEdit%
    Return
    }


Examples of use:

Code:
;-- If modification flag set, save file
if HE_GetModify(hEdit)
    HE_SaveFile(hEdit,"C:\Test.txt")



;-- Clear modification flag
HE_SetModify(hEdit,false)




;-- Populate the control then empty UnDo buffer
HE_ReplaceSel(hEdit,"Stuff that I'm adding to the control for the 1st time")
HE_EmptyUndoBuffer(hEdit)
    ;-- The HE_EmptyUndoBuffer can be used to keep the user from "accidentally"
    ;   undoing a developer-initiated operation that updates the Undo buffer.



HE_Scroll(hEdit,1)                      ;-- Scroll down 1 page
HE_Scroll(hEdit,-2)                     ;-- Scroll up 2 pages
HE_Scroll(hEdit,0,5)                    ;-- Scroll down 5 lines
HE_Scroll(hEdit,0,-25)                  ;-- Scroll up 25 lines
HE_Scroll(hEdit,2,-5)                   ;-- Scroll down 2 pages and then up 5 lines



HE_LineScroll(hEdit,25)                 ;-- Scroll 25 characters to the right
HE_LineScroll(hEdit,-5)                 ;-- Scroll 5 characters to the left
HE_LineScroll(hEdit,0,50)               ;-- Scroll down 50 lines.
HE_LineScroll(hEdit,0,-7)               ;-- Scroll up 7 lines.
HE_LineScroll(hEdit,-999999,-999999)
    ;-- Scroll to the top/left.  Similar to the Ctrl+Home hotkey.

HE_LineScroll(hEdit,-999999,999999)
    ;-- Scroll to the bottom/left.  Similar to the Ctrl+End hotkey.

Although I've tested these functions, they haven't gone through extensive field testing. If desired, add these functions to the HiEdit library at your discretion and with any changes you see fit.

I hope that someone finds this useful.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 12th, 2008, 1:30 pm 
Offline

Joined: July 17th, 2008, 9:46 am
Posts: 225
Hi @ all:
I have a question:
Is it possible to add a g-Label to a HiEdit control ?
WfG,
DHMH


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2008, 7:20 pm 
Offline

Joined: October 24th, 2007, 10:27 pm
Posts: 24
Hi,

A couple of questions, if anyone could answer them please?

1) Other than saving the text from a hiEdit control to a file, or highlighting the whole text. How can you get the text from hiEdit into a variable?
I don't want to save it to a file first and highlighting a lot of text to get it in the variable causes a flicker problem.

2) How do you move/resize the control once positioned?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2008, 12:06 pm 
Offline

Joined: January 18th, 2006, 7:39 am
Posts: 274
Location: Conway, Arkansas
Q wrote:
1) Other than saving the text from a hiEdit control to a file, or highlighting the whole text. How can you get the text from hiEdit into a variable?

This example assumes that hEdit is your hWnd variable:

Code:
HE_GetTextRange( hEdit, 0, -1 )


Q wrote:
2) How do you move/resize the control once positioned?

The easiest way is to use Titan's Anchor script. Just pass in the hWnd like this (again, assuming hEdit is your hWnd):

Code:
Anchor( hEdit, "wh" )


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2008, 8:45 pm 
Offline

Joined: October 24th, 2007, 10:27 pm
Posts: 24
Thanks, very much, i'll try it out


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2008, 11:58 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
SetFont setting doesn't behave correctly. I tried setting Tahoma, Central European, 7 and it won't accept size and encoding - stays on Western, 8.
Also black background is kinda depressing and the SetColor customization appears to be 'homework'. :(

Could this be taken care of, someday, please? Thank you.

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 240 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group