Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

New controls on GUI windows (Buttons, Statics, HMTL, RTF...)


  • Please log in to reply
132 replies to this topic
Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Hi,
just another dll to support more controls.
Posted Image
You have to download the MFC-dlls only if my dll does not run correctly:
First you have to install the Microsoft VCRedist. (2 files, because there's a uploadlimit)
https://ahknet.autoh...6.sfx.part1.exe
https://ahknet.autoh...6.sfx.part2.rar
Then you need the updated dlls (extract them in the folder of my dll and the script
https://ahknet.autoh...FC_DLLsGrid.zip

Here is the dll and a few example scripts for the controls:
https://ahknet.autoh...CtrlSupport.zip V1.32
Extract all files of the zip into one folder.
Start TestCtrlSupport.ahk for the main-example
HTML_CtrlSupport.ahk is a small browser-demo
RTF_CtrlSupport.ahk shows a RTF-Editor
TestCtrlSupportEdit.ahk are different edit controls.

A little documentation how to use the controls is here


There's also a betaversion for a grid-control
Posted Image
Ciao
Micha

--------------------------------
TODOs:
Grid: the grid needs an CWinApp. It seems that AHK does not have one or I can't reach it. I've created an new instance of CWinapp, but the tooltips are using the messageloop to receive mouse-clicks but they never reaches the CWinapp, because they are captured by AHK

Edit-controls: Wrong font. After creating the controls, EditControl->SetFont(Dialog->GetFont()) must be called, but GetFont returns NULL.
HTML-Control: Enter,BS,cut,copy are not working
RTFEdit: SearchReplace-dialog
RTFEdit: AfxRegisterWndClass is not working in release
http://www.pablosoft...cklistctrl.html
http://www.pablosoft...orcombobox.html
http://www.pablosoft...magebutton.html
http://www.pablosoft.../ctaskpane.html
User-drawn menus with icons
RTF: Tabs aligned to the left, to the center, to the decimal point, added to the right justified actual tabulations. And for the moment the tabs can be moved but not added nor deleted, may be it would be a good thing to be able to do so...
perhaps Ploticus (from the Utilities & Resources forum)
Better documentation
--------------------------------
08-03-06 Added docu for piecontrol
09-03-06 Added Secured Edit Control
12-03-06 Added Color Picker
12-03-06 Choose your own font to display the numbers of the wallclock. Adjusted the positions of the numbers. You can turn off the date.
12-03-06 Added Dynamic LED
14-03-06 Added first try of a html-control. Not finished !
16-03-06 Changed RTFEdit, enhanced HTMLCtrl
17-03-06 Added user-definable Back/color for LED-static
18-03-06 Added to HTML-control: AddFavorites, AutoDetectURL, BackColor, ClearSelection, Copy2Clipboard, SetFont, Get/SetFontName, Get/SetFontSize
23-03-06 VideoControl. (Posted as new thread)
24-03-06 Colored buttons (FooButton)
26-03-06 Colored Listbox, removed IconButton from todolist. FooButton can already do it. Removed CHistoryCombo, because that can be done without the need for an extra control. You can do it with an easy AHK-script.
29-03-06 Added very cool progress control
03-04-06 Added border to the progress control
04-04-06 Added HTML-support.
05-04-06 HTML-Control: While dllcall I send a msg to AHK. It seems they were ignored. Searched for another solution
08-04-06 Added new demo-script for editcontrols. TestCtrlSupportEdit.ahk. Added new edit controls for time, date, numeric...
10-04-06 Added Textcolor, Hilight, Background color for RTF-control
22-04-06 RTF: Shortcuts like Ctrl-B for Bold, Ctrl-U for underline, Ctrl-I for Italics, Ctrl-D for the font dialog Ctrl-H for Hilight (when the caret is in the edit field) RTF: LineIndex, GetLine, GetLineCount, & ReplaceSel
23-04-06 RTF: Added various selection functions (color, BKColor, Hilight...)
29-04-06 RTF: A search/replace function
10-05-06 MaskEdit: More possible mask characters (exclusion of chars)
18-05-06 MaskEdit: You can set a array of valid chars
30-05-06 Added animated GIF-support
16-08-06 Added PeakMeter
03-03-07 Added GridCtrl
29-03-07 GridCtrl: SetCellColor, SetCellType, Selectable(on/off), Sortable(on/off)

  • Guests
  • Last active:
  • Joined: --
Added 2DStatic and scrolling text.

Which controls do you need?

Ciao
Micha

evl
  • Members
  • 1237 posts
  • Last active: Oct 20 2010 11:41 AM
  • Joined: 24 Aug 2005
Interesting controls although I'm not working on anything at the moment to really justify using them. I'm sure someone mentioned on here about a site that had a whole load of examples of different controls - do you know of such a place with illustrated examples? That would be easier for people to browse through and see what might be useful to be able to use in AHK.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Fantastic! The 2Dstatic control allows drawing circles, lines, anything, much faster than Shimanov's pure AHK solution. Finally, we can have drawings in a GUI window. Thanks for sharing it!

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Hi,
nice to have any reply if this could be useful :-)
I thought, I'll start this thing and if nobody find this useful I won't enhance it.

Therefore thanks for your reply!

A good place is www.codeproject.com (MFC-Controls) or codeguru.com to look for other controls.

The 2DStatic-control only can draw functions. If you need drawing of circles, rects, dots, line etc. I can write such a control and add it to the dll.

Ciao
Micha

P.S. I'm grateful for every hint, idea, bug and hints of spelling errors in the documentation!

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Hi Micha,
I currently have no need of a new control, but I'll come back if I'm in need. Thanks for sharing. I guess that some of the controls will be used by people who want to spice up their "about" guis for their apps. I will keep the RotStatic in mind, it might come handy.

The only control I could invision some people might want to try is a analog clock like control.
You could use it as a clock (with three independant arms) or as a speed meter (CPU load, memory usage, disc capacity, etc) as a full shape starting at 12 o'clock and chnaging its color depending on value.

Another control would be a simple edit control that always shows the last line when it is filled with text. I use edit controls to show log information. But each time I fill the edit control it only shows the first lines, for the rest I have to scroll down. The new control would show the last lines and the user would need to scroll up to see the previous lines. But I guess this might be easier to achieve with a sendmessage to a regular edit control.

I also saw several people asking for a HTML control or video control. But these controls might be way out of scope.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Demokos
  • Members
  • 105 posts
  • Last active: Jan 20 2011 06:28 PM
  • Joined: 28 Dec 2005
Superb ! Suggestions ? From CodeProject, i'd like to see these ones implementeds in AHK :
Secure Edit Control
Masked Edit Control
Using the WebBrowser control, simplified.
Dynamic LED Control
and, if it's possible,
CRulerRichEditCtrl - a complete RTF mini-editor
Of course if you can and want to...
Anyway, thank you for the controls which were already carried under AHK by yourself.

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Hi,
added clock and masked edit.

Thanks for your compliments.

@toralf: I've added an analog clock but this one is only useful to show the time. If you change the time with functions of the class, it will change the systemdate...not very useful...
Thus it's not useful as speed meter. I'll try to change the control to support this.

Another control would be a simple edit control that always shows the last line when it is filled with text

I have written a lot of tools which were logging things, too.
I've used a colored listbox. (warnings yellow, errors red).
If logging a line of text, I did not add the one to the end but I inserted the text at index 0 of the listcontrol. Thus every new entry is shown at the first position, the older below.

HMTL-control is in work...

@Demokos: Masked edit is implemented.
Just a question: Why do you need a secured edit control? At the latest when you want to compare the password if it is correct, you have to ask the edit control for it. You have to assign the password to an AHK-variable. Thus the password can be printed to screen... not very save :wink:

Ciao
Micha

AGU
  • Guests
  • Last active:
  • Joined: --

HMTL-control is in work...

I think this is a great idea. There's definitely a need for this as I have read some comments over the months that have a demand for it (including myself).

My wish would be some good documentation. What is needed on the system. Which OS is minimum - is e.g. W95 supported?

Looking forward - Keep up the good work. :D

(and please think of an "easy-to-understand" documentaion for people like me. ;))

_______
Cheers
AGU

Demokos
  • Members
  • 105 posts
  • Last active: Jan 20 2011 06:28 PM
  • Joined: 28 Dec 2005
Thanks Micha, the Masqued Edit is very good.
For the secured edit control : we have already the possibility to mask the imput with stars with AHK, but I think (I must confess I'm not sure) that it isn't immune to "sniffers" progs that reveal what you type on keyboard, even with the stars... The author say that the control can avoid that. So I think this type of control is probably more secure that the AHK one. May be I'm wrong, I don't know.

HMTL-control is in work...

Very good news. Thanks.
I'm not too bad to programm in AHK but I haven't any knowledge in C++. If so, I'd like to do so good work as you make. Thanks again.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Am I doing something stupid? I cannot load it:
dll = C:\t\AutoHotKey\AHKCtrlSupport.dll
hModule := DllCall("LoadLibrary", "str", dll)
MsgBox % FileExist(dll) "`n" hModule "`n" ErrorLevel
The dll file is found (its attribute "A" is shown in the message box), but hModule remains 0, ErrorLevel = 0. Also, the line
nRC := DllCall(dll "\CreateWallClockStatic",int,x,int,y,int,width,int,height,int,nID,"Cdecl Int")
returns ErrorLevel = -3 (The specified DllFile could not be accessed). What's wrong?

I copyed the mfc dll files to my Windows\System32 directory. No change.

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Hi,

@Toralf: You mentioned an analog clock. Do you really mean a clock or a pie chart: 100% is a full circle and 25 % is a quarter?

@AGU:

...good documentation...


I've thought about an easier interface a lot of times. I could write wrapper-functions you could include in your script but that does not make anything easier. You have to supply the same amount of arguments. To make the script smaller you could remove the errorcode lines. Then there is only the dllcall left but if something goes wrong you can't handle that.
So I decided to keep the direct dllcall for the moment.
What can I do better in the existing documentation? As almost every programmer I hate to write docus :-) but I thought that it isn't enough to provide example scripts. Thus I added the documentation for the needed parameters at least.

I'll try to explain global things like: how to create a new control (Create one with gui, add and call the dll with a handle to the existing window or create it directly by supplying x, y, width, height......)

...Which OS is minimum...

I think the more controls are added the possibility is getting lower to support Win95/98/ME since a lot of controls need Win200 at least.

@Demokos: There are a lot of programs to reveal the text behind the ****. In C++, which is compiled to machine-code you can make things more difficult for hackers by using the mentioned control. If you use that control in a script and the user entered the password, what do you do with that? You will need the plain password to forward it to an external programm (run, net use x: \\pc\c% /USER:user ****) or you have to get the passwort to compare it in your script. That makes only sense if you compile + encrypt the script to an exe.

@Lazlo:
---------------------------
Kopie von TestCtrlSupport.ahk
---------------------------
A
15269888
0
---------------------------
OK
---------------------------
Have you tried to copy the 4 dll + manifest-files to the dll-folder?
I've changed my script to load the dll in the same manner as you did and it worked. The script seems ok.
Have you tried to analyse it with dependency walker? Another user had the same problem with another dll from me. The reason was that he forgot to put the manifest files to the same directory as the dlls. Which OS do you have?
If you still have problems and want to, I can look to your computer with netmeeting to analyse the problem.

-------------------------------------------------
@ ALL who need a HTML control:

There are a lot of selfmade controls to view html-code.
Some solutions only support few codes (bold, italic, link) which is enough for most people, some other have programmed a solution which supports more styles.
There is a ready2use control from Microsoft which supports everything because it's the same control the IE uses.
The reason why there are so much self-programmed solutions is that the Microsoft control needs to load a lot of dlls. These are really huge. The start of an application which uses this control lasts remarkable long.

I need to know, what you really need a HTML-control for. Do you need it to view only bold, italic text with support for links or do you need the whole load of functionality?
If you do not need the full load, I can use a small and fast selfmade solution. If you need everything I have to implement the microsoft control which makes the dll bigger and slower.

Ciao
Micha

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Hi Micha, I guess a pie chart is what I talked about.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Demokos
  • Members
  • 105 posts
  • Last active: Jan 20 2011 06:28 PM
  • Joined: 28 Dec 2005
At first Micha congratulation for the RTF control. By "including" this control in AHK, you raise the power of AHK. Thanks

For the Secure Edit control, I thought it can be usefull in a compiled script, and that in this case the security level would be sufficent. I don't think that it is possible to be absolutely protected against sniffers, but if the work to reveal the password would be harder, that could be sufficent. If you think that it isn't true, never mind. I trust you, and what you done is allready fantastic, in my opinion.

for the HTML control : what I'd like to have is hyperlinks with anchors and basic markups for the presentation of the information : font and size for the character, bold, italics, underline and color. For my point of view, this control could be used to display a basic help information, not as complete as a chm file. For me, if I need someting more complex, I will create a chm file or run the html browser with the page I want to display..

So I'd like to be able to use :
a, b, body (of course), br, center, font (font size, font color), h1...5, html (of course), i, link, (may be) li ol & ul (lists), p, (may be) sub and sup, title, u,... (of course with the and ...

I think that a full HTML support, even if it can be of interest, is not really usefull in the AHK environnement.

Thanks again for all your work.

robiandi
  • Guests
  • Last active:
  • Joined: --
@micha: I find it very useful, many thanks.