AutoHotkey Community

It is currently May 25th, 2012, 9:39 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 157 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next
Author Message
 Post subject:
PostPosted: October 16th, 2007, 8:16 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
It would be good to post sample.

Quote:
There is also another error when you try to load a standalone .ico
That error message is probably system one, i never tried to load ico myself, nor I like this dialog. I just made it for compliteness.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2007, 10:27 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1832
yeh it definitely is a system message, but was wondering why it appeared and how to get rid of it. to try it out, install Amun and then in the options part then choose an icon (not 1 within exe, dll etc)

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2007, 12:12 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
I tried this and it works here without errors:

Code:
 icon="c:\Art\Icons\icons\editcopy.ico"
 if CmnDlg_ChooseIcon(icon, idx := 4)
       msgbox Icon:   %icon%`nIndex:  %idx%


I checked out in Amon and saw what is going on. This is, however, behavior of the system and can not be changed.

There are many reasons not to like this system dialog. Thats why I created ChooseIconEx.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2007, 10:39 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Version 3.0
Added Find & Replace standard dialogs



Code:
;----------------------------------------------------------------------------------------------
; Function:     Find / Replace
;               Display standard Find and Replace dialog boxes
;
; Parameters:
;               hGui    - Handle to parents HWND
;               lbl     - Label used for communication with dialog. CmnDlg_Event, CmnDlg_FindWhat and CmnDlg_Flags hold the dialog data
;               flags   - Creation flags
;               deff    - Default text to be displayed at the start of the dialog box in find edit box
;               defr    - Default text to be displayed at the start of the dialog box in replace edit box
;
; Flags:        String containing list of creation flags. You can use "-" infronto of the flag to hide that GUI field
;               d - down radio button selected in Find dialog
;               w - whole word selected
;               c - match case selected
;
; Globals:      Dialog box is not modal, so it communicates with the script using 4 global variables:
;                   Event    - close, find, replace, replace_all
;                   Flags    - string contaning flags about user selection; each letter means user has selected that particular GUI element.
;                   FindWhat - user find text
;                ReplaceWith - user replace text
;   
; Returns:     
;               Handle of the dialog or 0 if dialog can't be created. Can also return "Invalid Label" if lbl is not valid.
;
CmnDlg_Find( hGui, lbl, flags="d", deff="")
CmnDlg_Replace( hGui, lbl, flags="", deff="", defr="")
 

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2007, 2:58 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
I just started to play with the Find function and I ran into a problem. The Find dialog closes correctly when I click on the Cancel button but the dialog remains open when I click on the Find button. What do I need to do to get the Find dialog to close after I click on the Find button?

Thanks for your help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2007, 4:29 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Thats by design. Find and Replace dialogs are not modal, they stay open so user can press Find Next button again. There is also "close" event which notifies you the dialog is closed so you can free the data that u eventualy allocated for searhing.

You can manualy close the dialog whenever you want. The function returns handle of the dialog so code

Code:
#persistent
 Gui, +lastfound
 hDlg := CmnDlg_Find( WinExist(), "OnFind")
return

OnFind:
     Msgbox % CmnDlg_FindWhat
     WinClose, ahk_id %hDlg%
return


will close the dialog after user pressed find.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2007, 2:06 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
majkinetor wrote:
Thats by design. Find and Replace dialogs are not modal, they stay open so user can press Find Next button again. There is also "close" event which notifies you the dialog is closed so you can free the data that u eventualy allocated for searhing.

Thanks for the feedback. I'll give it try.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2007, 6:18 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
I just started to test the Find dialog and I ran into a problem. The "-w" flag doesn't do anything. In fact, if the "-w" flag is defined, all other flags are ignored. I did a quick test on Replace dialog and the "-w" flag appears to work correctly.

Let me know if you need any additional information.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2007, 11:38 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Thx, fixed.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2007, 3:20 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
v4.0
Added Open/Save dialog.
MHT doc tonight.

Code:
;----------------------------------------------------------------------------------------------
; Function:  Open / Save
;            Display standard Open / Save dialog
;
; Parameters:
;            hGui            - Parent's handle, positive number by default 0 (influences dialog position)
;            Title          - Dialog title
;            Filter          - Specify filter as with FileSelectFile. Seperate multiple filters with "|"
;            DefultFilter    - Index of default filter, by default 1
;            Root          - Specifies startup directory and initial content of "File Name" edit.
;                        Directory must have trailing "\".
;            DefaulltExt     - Extension to append when none given
;            Flags           - White space separated list of flags, by default "FILEMUSTEXIST HIDEREADONLY ENABLEXPLORER"

;  Flags:
;         ALLOWMULTISELECT   - Specifies that the File Name list box allows multiple selections ...
;         CREATEPROMPT      - If the user specifies a file that does not exist, this flag caus ...
;         DONTADDTORECENT      - Prevents the system from adding a link to the selected file in t ...
;         EXTENSIONDIFFERENT   - Specifies that the user typed a file name extension that differs ...
;         FILEMUSTEXIST      - Specifies that the user can type only names of existing files in ...
;         FORCESHOWHIDDEN      - Forces the showing of system and hidden files, thus overriding t ...
;         HIDEREADONLY      - Hides the Read Only check box.                           ...
;         NOCHANGEDIR         - Restores the current directory to its original value if the user ...
;         NODEREFERENCELINKS   - Directs the dialog box to return the path and file name of the s ...
;         NOVALIDATE         - Specifies that the common dialog boxes allow invalid characters  ...
;         OVERWRITEPROMPT      - Causes the Save As dialog box to generate a message box if the s ...
;         PATHMUSTEXIST      - Specifies that the user can type only valid paths and file names ...
;         READONLY         - Causes the Read Only check box to be selected initially when the ...
;         SHOWHELP         - Causes the dialog box to display the Help button. The hGui recei ...
;         NOREADONLYRETURN   - Specifies that the returned file does not have the Read Only che ...
;         NOTESTFILECREATE   - Specifies that the file is not created before the dialog box is  ...
;
;  Returns:
;            Selected FileName or Emtpy when cancelled. If more then one file is selected they are separated by new line character.
;
;  Example:
;         CmnDlg_Open(0, "", "Text Files (*.txt)", "", "c:\Windows\setuplog", ".ahk")
;      


Big thanks to DerRaphael for initial code which I rewrote to fit the CmnDlg philosophy.

Among other things this dialog implements, notice that if you set correctly hGui, it will not pop up on 0,0 like FileSelectFile does, always (unless you do SetTimer mumbo jumbo)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2007, 5:31 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
MHT doc updated

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2008, 12:32 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
v4.01
Bug fix in Open/Save dialog
First page updated - docs online, direct download to script.
Dialog names are changed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2008, 6:56 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
v4.03
Bug fix in Open dialog.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2008, 8:30 pm 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1832
your icon module doesnt give the correct idx. it always gives 1

this works fine for me:

Code:
CmnDlg_Icon(ByRef sIcon, ByRef idx, hGui=0)
{                             
   VarSetCapacity(wIcon, 1025, 0)
   If !DllCall("MultiByteToWideChar", "UInt", 0, "UInt", 0, "Str", sIcon, "Int", StrLen(sIcon), "UInt", &wIcon, "Int", 1025)
   Return, 0
      
   idx--
   If !DllCall(DllCall("GetProcAddress", "Uint", DllCall("LoadLibrary", "Str", "shell32.dll"), "Uint", 62), "UInt", hGui, "UInt", &wIcon, "UInt", 1025, "Intp", idx)
   Return, 0
   idx++

   Len := DllCall("lstrlenW", "UInt", &wIcon)
   VarSetCapacity(sIcon, Len, 0)
   Return, DllCall("WideCharToMultiByte", "UInt", 0, "UInt", 0, "UInt", &wIcon, "Int", Len, "Str", sIcon, "Int", Len, "UInt", 0, "UInt", 0) ? 1 : 0
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2008, 11:55 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Documentation and code updated.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 157 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Klark92 and 5 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