 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Do you want HiEdit internaly |
| Yes |
|
52% |
[ 37 ] |
| No, I like Edit control |
|
28% |
[ 20 ] |
| Other (please explain) |
|
19% |
[ 14 ] |
|
| Total Votes : 71 |
|
| Author |
Message |
TodWulff
Joined: 29 Dec 2007 Posts: 116
|
Posted: Sat Apr 26, 2008 8:54 am Post subject: WOO HOO!!! |
|
|
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:
Here is a pic showing the docked IDE looking at the preprocessor debug dialog:
Here is a pic showing an undocked IDE with the issue I am seeing with the elements not being re-drawn properly:
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).
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...:
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... |
|
| Back to top |
|
 |
TodWulff
Joined: 29 Dec 2007 Posts: 116
|
Posted: Sat Apr 26, 2008 7:17 pm Post subject: |
|
|
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... |
|
| Back to top |
|
 |
majkinetor! Guest
|
Posted: Sun Apr 27, 2008 8:00 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
TodWulff
Joined: 29 Dec 2007 Posts: 116
|
Posted: Mon Apr 28, 2008 10:38 pm Post subject: |
|
|
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... |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4116 Location: Belgrade
|
Posted: Tue Apr 29, 2008 9:14 pm Post subject: |
|
|
| 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. _________________
 |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Jun 20, 2008 7:02 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 2198 Location: GERMANY
|
Posted: Sun Aug 17, 2008 2:22 pm Post subject: |
|
|
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
} |
_________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1317 Location: USA
|
Posted: Sun Aug 17, 2008 2:37 pm Post subject: |
|
|
it's probably zero based. _________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 2198 Location: GERMANY
|
Posted: Sun Aug 17, 2008 3:27 pm Post subject: |
|
|
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? _________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 537 Location: Texas, USA
|
Posted: Tue Oct 07, 2008 4:31 am Post subject: Additions to the HiEdit library |
|
|
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. |
|
| Back to top |
|
 |
DHMH
Joined: 17 Jul 2008 Posts: 194
|
Posted: Sun Oct 12, 2008 1:30 pm Post subject: |
|
|
Hi @ all:
I have a question:
Is it possible to add a g-Label to a HiEdit control ?
WfG,
DHMH |
|
| Back to top |
|
 |
Q
Joined: 24 Oct 2007 Posts: 24
|
Posted: Thu Oct 16, 2008 7:20 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
skwire
Joined: 18 Jan 2006 Posts: 267 Location: Conway, Arkansas
|
Posted: Fri Oct 17, 2008 12:06 pm Post subject: |
|
|
| 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" ) |
|
|
| Back to top |
|
 |
Q
Joined: 24 Oct 2007 Posts: 24
|
Posted: Fri Oct 17, 2008 8:45 pm Post subject: |
|
|
| Thanks, very much, i'll try it out |
|
| Back to top |
|
 |
Drugwash
Joined: 08 Sep 2008 Posts: 608 Location: Ploiesti, RO
|
Posted: Wed Oct 22, 2008 11:58 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|