AutoHotkey Community

It is currently May 25th, 2012, 6:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: May 26th, 2007, 9:36 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2540
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2007, 8:20 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2007, 9:07 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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).

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2007, 9:11 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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 ... :lol: :wink:

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2007, 1:06 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2007, 2:23 pm 
Offline

Joined: October 28th, 2006, 2:14 am
Posts: 297
Location: US
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 :oops:) 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 :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2007, 6:43 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 28th, 2007, 12:39 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
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.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 28th, 2007, 6:16 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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).

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 28th, 2007, 7:23 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Quote:
Anyway, script execution skips function declarations (right?)
I thought AHK stops AutoExecute section at first function decl...

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 28th, 2007, 11:47 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
No

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 28th, 2007, 12:45 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
More info at: Using #Include to Share Functions Among Multiple Scripts

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 28th, 2007, 6:10 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 2nd, 2007, 1:05 am 
Offline

Joined: October 28th, 2006, 2:14 am
Posts: 297
Location: US
Quote:
if I am the judge
Well you're not, so shut up :D 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 :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 2nd, 2007, 1:28 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
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.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Leef_me, tkmmkt and 15 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