Jump to content

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

[module] Dlg 5.01


  • Please log in to reply
37 replies to this topic
n-l-i-d
  • Guests
  • Last active:
  • Joined: --
:p Ok, no COM this time... Thanks.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
I updated ChooseFont.

You are now allowed to set initial color, and bug about default font height is corrected based on the knowledge I get with GetTextSize func.


pFace - initial font, output
pStyle - initial style, output (AHK font syntax)
pColor - initial text color, output
hGui - parent gui, affects modality and position

Returns : false on cancel


Posted Image

Markus M.
  • Members
  • 14 posts
  • Last active: Dec 17 2007 01:14 PM
  • Joined: 17 Apr 2007
great stuff, thanx a lot majkinetor :-)
it is very usefull for my current script, where i need the pick icon dialog.

i had some probs with win 2000, as the function is not exported by name, but by ordinal.
after a little research i found a solution to solve this prob.

changing line 28 in chooseicon.ahk to:
r := DllCall(DllCall("GetProcAddress", "Uint", DllCall("LoadLibrary", "str", "shell32.dll"), "Uint", 62), "uint", hGui, "uint", &wIcon, "uint", 1025, "intp", idx)
it works also in xp. have not tested it yet in other versions like win-me or 9x.
but just a thing i'm curious about: when i searched the web for PickIconDlg and win2000, i've read something about the strings must be converted to unicode to work properly with w2k. i did not played around with the unicode thing as it seems to work fine, even if using german special chars. :?:

one little other thing in dialogs.ahk. when changing the line 13 to:
Gui, add, picture,% "x10 icon"idx+1, %icon%
it displays the correct icon.

as i'm new to ahk and this forum just let me say it's a great treasure chest of knowledge in here, and it seems to be a nice community :lol:
and after beeing away from windows programming for years, it is great to start again with ahk. can't remember having so much fun with coding :wink:

Posted Image

BoBo
  • Guests
  • Last active:
  • Joined: --

and after beeing away from windows programming for years, it is great to start again with ahk.

@ Markus
und sollte es dich mal gelüsten AHK auf Deutsch zu diskutieren - das Deutsche AutoHotkey-Forum. Have fun. 8)

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

changing line 28 in chooseicon.ahk to:

Nice solution. When I created those functions, this command wasn't possible in AHK and I don't care much about systems prior to XP. I will see to find time to update the code with your changes as it is win2k, but I don't support dead systems in my programming, like Win9x.


but just a thing i'm curious about: when i searched the web for PickIconDlg and win2000, i've read something about the strings must be converted to unicode to work properly with w2k.
I convert it to unicode using:
DllCall("MultiByteToWideChar" ....
AHK doesn't support unicode, but this is binary thing.

when changing the line 13 to: ... it displays the correct icon.

The bug.


BTW, I don't use this dialog as it is stupid. I provided it here for the sake of compliteness. U should use ChooseIconEx for more advanced icon control

das Deutsche AutoHotkey-Forum.|

2 Markus

Welcom to the AHK forum. You will have good time here if you don't listen what BoBo speaks. Limit yourself to his regular "resource & utilities" posts to get the best out of it. Joining German forum is certanly not a good idea, as of knowledge split.
Posted Image

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Dear majkinetor,

Thanks for these functions.

Looking at the describtion:

Returns : false on cancel
RETURNS: -1 on cancel, RGB value on OK
Returns: positive number on error, 1 on cancel

It seems confusing that one returns -1 on cancel, the other 0 and the third 1. Would it make sense to make them behave more identical? E.g. positive value for a result, negative value for Error and -1 for cancel.

Just my two cents
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.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
You are right.

I created those functions separately over larger time. I just joined the functions on this page.
Posted Image

Markus M.
  • Members
  • 14 posts
  • Last active: Dec 17 2007 01:14 PM
  • Joined: 17 Apr 2007
@majkinetor:
oh, "MultiByteToWideChar" :roll: i've been totally focused about the pickicondialog, so i've completely overseen it.
your ChooseIconEx looks very nice and comfortable, gonna test it now.
seems to to be the better solution, as the pickicondialog is not modal (or i dunno how to make it modal)
i don't think it is about splitting knowledge joining the german forum, as some ppl are not capable of the english language.

@BoBo: danke für die einladung werde dort mal vorbeisehen :-)

Posted Image

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
Gui +OwnDialogs I thnk will help you make it modal, IIRC.

Markus M.
  • Members
  • 14 posts
  • Last active: Dec 17 2007 01:14 PM
  • Joined: 17 Apr 2007

Gui +OwnDialogs I thnk will help you make it modal, IIRC.


seems only to work with ahk dialogs, but not with dialogs invoked by dll calls. thanks anway for your help.

Posted Image

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
There is, sadly, no method to show modal windows in AHK. You can make only dialogs modal.

That is the reason why ChooseIconEx uses modality loop at the end of its function main function.
Posted Image

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

i don't think it is about splitting knowledge joining the german forum, as some ppl are not capable of the english language.

You are obviously not one one of them, so in your case it would be.
Posted Image

Markus M.
  • Members
  • 14 posts
  • Last active: Dec 17 2007 01:14 PM
  • Joined: 17 Apr 2007

There is, sadly, no method to show modal windows in AHK. You can make only dialogs modal.

That is the reason why ChooseIconEx uses modality loop at the end of its function main function.


this one works:
gui, +disabled
ChooseIcon(IconFile, IconIndex, hGui)
gui, -disabled
gui, show
a lot off stuff i've got to learn about ahk and windoze coding :roll:

i've tested your iconex. it is really nice but slow when browsing large dirs like system32.

Posted Image

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

it is really nice but slow when browsing large dirs like system32.

Yes. Its not made for browsing system32 but icon packs ;)
Pick icon can't even see a dir.
BTW, i will give you a medal if you improve its speed. Its just the fact, again, that ahk is made for different kind of things in mind.


this one works:

You missed the point. Make the ChooseIconEx function block the caller script and then report back.
Posted Image

Markus M.
  • Members
  • 14 posts
  • Last active: Dec 17 2007 01:14 PM
  • Joined: 17 Apr 2007

this one works:

You missed the point. Make the ChooseIconEx function block the caller script and then report back.


not really. i was concerning the dll call, not ChooseIconEx.
sorry for this confusion :mrgreen:

Yes. Its not made for browsing system32 but icon packs :Wink:
Pick icon can't even see a dir.
BTW, i will give you a medal if you improve its speed. Its just the fact, again, that ahk is made for different kind of things in mind.


even if i'm new to ahk, i noticed is limitations. but it still covers my needs. i've got VB express and delphi personal. but it takes too much time to getting used to it. apart from the fact that the VB express is totally useless for small tools, concerning the fact to deploy a huge .net redistributable.

Posted Image