 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
corrupt
Joined: 29 Dec 2004 Posts: 2421
|
Posted: Sat May 26, 2007 8:36 pm Post subject: |
|
|
Thanks for putting together a list (although a rather small and incomplete one).
| majkinetor wrote: | | The RichEdit will probably be created soon (by corrupt) without requirement for DLL. | Although it doesn't make much of a difference to me, I'm curious. What would be needed for you to add the cGUI and RichEdit functions to your list? They already create a functional control and the current functionality is documented. A screenshot is available and a .zip file is available for download that contains the necessary files and examples. If there is something that doesn't meet your requirements then please let me know so that I can consider making the necessary updates. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3644 Location: Belgrade
|
Posted: Sun May 27, 2007 7:20 am Post subject: |
|
|
2 corrupt
Can you select word in control and change its font ? The very basic feature of RichEdit. When it gets done, I will add the control.
| Elevator_Hazard wrote: | | Hmmm... Comments that must follow a certain standard and if the control requires a lot of documentation you could use Natural Docs, I fell in love with your MMenu documentation and I may start using Natural Docs when the need arises |
I will soon create thread about what is needed for Natural Docs to be used with AutohotKey
| Elevator_Hazard wrote: | | I think that Titan's Captcha Control should be added on the list, all the code needs is maybe a few more comments telling the person using it what the parameters do in detail. |
Captcha is almost here, it just needs some tweaking. THere is a function named Random and function named Pass. Probably every second programmer has those in their own scripts. There is also thing that Titan mention about array of controls.. perhaps he can make it less error prone.
| Titan wrote: | | This list seems to be real 3d party controls with wrappers for the dll calls. |
Not at all. I concentrated to collect all good controls created around with or without dll's. Of course DLL must be small, not big as AHK itself (acctually, all dlls at first post are probably around 100K together). Wrappers must not have globals that can interfere with outer world and some other things. How to write good wrappers is topic for itself and it should be explained in thread. However, I first wanted to see if smb has some suggestion or proposition for possible interface.
The bottom line is only that users of these controls will not have more pain than joy while using them. I am shure I missed something good so it would be good ppl point that to me. _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sun May 27, 2007 8:07 am Post subject: |
|
|
| majkinetor wrote: | | Wrappers must not have globals that can interfere with outer world | In other words, globals must not be initialized in autoexecute section (outside functions) because some people like majkinetor prefer to #Include at the end of the script, where the autoexecute section is likely to be ended (and thus, globals are likely to remain uninitialized).
And any global (and function name) must have some prefix to reduce the risk of collision: instead of creating a SetNextUInt function, name it CreateWindow_IPA_SetNextUInt (ie. here I used the name of the AHK file as prefix). Same for label names!
That's where we regret not to have local functions, or namespace, or some other kind of encapsulation (like putting functions in a table, or in a class). _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3644 Location: Belgrade
|
Posted: Sun May 27, 2007 8:11 am Post subject: |
|
|
| Quote: | | That's where we regret not to have local functions, or namespace, or some other kind of encapsulation (like putting functions in a table, or in a class). |
Exactly.
However its much more complex then that. OnMessage is particulary bad.
For instance if module needed to monitor WM_MOUSEMOVE it will remove user monitor. That's where we regeret not to have dynamic functions so we can do like
| Code: | MyMoudule_oldHandler := OnMessage(WM_MOUSEMOVE, "MyModule_MouseMove")
MyModule_MOuseMove(wparam, lparam, msg, hwnd) {
; do mu stuff here
;call original handler
MyModule_oldHanlder( wparam, lparam, msg, hwnd)
}
|
| Quote: | | because some people like majkinetor prefer to #Include at the end of the script, |
LOL.
What if you include 2 modules at the top of the script? You don't have to be majkinetor but it will still not work .
Acctually, "on top include" is good enough only for single include. Second, I would like to have insight about what is going on in MY OWN autorun section, perhaps I want to even use it ...  _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sun May 27, 2007 12:06 pm Post subject: |
|
|
| majkinetor wrote: | | What if you include 2 modules at the top of the script? You don't have to be majkinetor but it will still not work . | Well, if the autoexec section of the module is just a bunch of global variable inits, there is little risk. If it has any program flow breakage (goto, return, exitapp (!), hotkey (?) and so on, there is a risk, indeed, but mostly reflecting a poor design. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Elevator_Hazard
Joined: 28 Oct 2006 Posts: 302 Location: US
|
Posted: Sun May 27, 2007 1:23 pm Post subject: |
|
|
So you can make an initialization function that sets the needed globals: | Code: | SomeVar=20
SomeOtherVar=40
SF_SomeFuncInit(SomeVar)
someotherothervar=100
gosub, somegosub
return
SF_SomeFuncInit(SomeInt) {
global _SF_CheckInt:=SomeInt+20
global _SF_OtherVar:=SomeInt . "some string"
return
} | I've done that on a tooltip thing (I never finished it ) so that the user could set defaults for the rest of the functions by leaving those blank in that function. _________________ Changed siggy at request of ahklerner  |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3644 Location: Belgrade
|
Posted: Sun May 27, 2007 5:43 pm Post subject: |
|
|
| Quote: | | Well, if the autoexec section of the module is just a bunch of global variable inits, there is little risk. If it has any program flow breakage (goto, return, exitapp (!), hotkey (?) and so on, there is a risk, indeed, but mostly reflecting a poor design. |
Well, it doesn't have to do with bad design at all.
| Code: | #include Module1.ahk
#include Module2.ahk
... |
Module1.ahk
| Code: | Moudle1_var := 2
Module1_Function1(...)
... |
Module2.ahk
| Code: | Moudle2_var := 3
Module2_Function1(...)
... |
So you see, moudle2 autorun will never get executed. What is more ugly, result depends on order of modules....
Initialisation function is the only solution. _________________
 |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2699 Location: Australia, Qld
|
Posted: Sun May 27, 2007 11:39 pm Post subject: |
|
|
| majkinetor wrote: | | Initialisation function is the only solution. |
What if you did something like:
| Code: | ; auto-execute section
Module1_var := 2
goto endof_Module1 ; skip all functions, hotstrings, etc.
Module1_Function1(...)
...
endof_Module1:
; end of file
|
Would execution continue with the next line after the #Include?
Anyway, script execution skips function declarations (right?), so this wouldn't even be necessary if the script has no hotkeys/hotstrings (as long as you don't write "return.")
Initialization functions aren't the only solution. That said, they are the most consistent solution, in that it doesn't matter where the user #includes the script - the init code will always run. (Assuming it is called by the module itself the first time a module function is used.) |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon May 28, 2007 5:16 am Post subject: |
|
|
| majkinetor wrote: | | So you see, moudle2 autorun will never get executed. What is more ugly, result depends on order of modules.... | You are kidding, no?
I put my test code at the end of the functions (you are upset by that) and it works fine.
This code is OK:
| Code: | a := 1
FooA()
{
msgbox
}
b := 2
FooB()
{
msgbox
}
msgbox yo! %a% %b%
|
Of course, I agree that having a ModuleX_Init() function is cleaner, and more flexible (than autoexec or Gosub or imposed include placement). _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3644 Location: Belgrade
|
Posted: Mon May 28, 2007 6:23 am Post subject: |
|
|
| Quote: | | Anyway, script execution skips function declarations (right?) | I thought AHK stops AutoExecute section at first function decl... _________________
 |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3841 Location: Bremen, Germany
|
Posted: Mon May 28, 2007 10:47 am Post subject: |
|
|
No _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5376 Location: /b/
|
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3644 Location: Belgrade
|
Posted: Mon May 28, 2007 5:10 pm Post subject: |
|
|
After reading this I have to say just that I am correct again. Not for functions though, but for subroutines. This probably made me think the same is true for the functions. ANother inconsistent AHK behavior if I am to judge. _________________
 |
|
| Back to top |
|
 |
Elevator_Hazard
Joined: 28 Oct 2006 Posts: 302 Location: US
|
Posted: Sat Jun 02, 2007 12:05 am Post subject: |
|
|
Well you're not, so shut up just kidding
We could use a standard for sets of functions/custom controls... Like err... The name for a set of functions could be done by doing: | Code: | | ; -------- Set Name -------- | Which involves 8 hyphens and the name of the set of functions, and w/e amount of hyphens afterwords (for me I use the line you can use on PSPad and put it to 40 and put hyphens to there, but not everyone uses PSPad, so w/e you think you need). Also for an individual function that a user would use should be formated like this: | Code: | ; --- SomeFunc ---
; - Usage -
;# The use of this function is...
;# another line if needed, on and on...
; - Parameters: -
; Text - The text parameter is what will be put on the control, it is required
; Options - the options used to size the control like x y w h, this is optional
; - Return - This will return nothing (notice if the comment will be short, leave it on one line)
;# Other notes, maybe the version and info that doesn't fit in above
SomeFunc(text, options="") {
gui, add, text, %options%, %text%
return
} |
Or an alternative xml format. It would really help out people who want to implement some controls, and a standard was somewhat requested, so I thought I would share an idea. _________________ Changed siggy at request of ahklerner  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5376 Location: /b/
|
Posted: Sat Jun 02, 2007 12:28 am Post subject: |
|
|
If we use XML it should probably use a XAML/C# type schema since they're very comprehensive. Personally I would prefer a simpler text based format such as that of Natural Docs. _________________
 |
|
| 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
|