Pathname auto completion

I have a fill-in field that I need to prompt for a filename in and I want to use the windows filename auto complete (like the Win2K file-open dialog). I have read about SHAutoComplete from SHLWAPI.DLL and this appears to be what I need:
Code:
procedure SHAutoComplete external "shlwapi.dll":
    def input parameter hwndEdit as long.
    def input parameter dwFlags as long.
end procedure.
I called it from local-initialize like so:
Code:
run SHAutoComplete(lc_myedit:hwnd, 1).

The auto complete works, when I arrow through the list of matching items and select something it fills out the screen-value fine, but if I then continue to type the screen value is replaced with spaces for everything that wasn't typed.

It looks like progress keeps an internal representation of the screen value of widgets apart from the actual screen buffer. Has anyone got any suggestions on how this can be made to work?
 
As a followup I have found that and editor widget (with 1 line and no scroll bars) appears to work much better.

The only Issue with it is that the TAB and BACK-TAB keys are not processed or passed back to progress correctly.
 
Hi Simon,

It would be nice to see a working example of this stuff, I really like this :D

Could you, please, post an example somewhere ?

Cheers
 
Here is an example program.

The editor one works much better than the fill-in, but neither works with TAB or BACK-TAB :(.
 

Attachments

  • autocomp.w
    15.1 KB · Views: 29
Pretty nice !

The fill-in behaviour is a bit weird but the editor works very well (at last under W2k).

Have you thinked about posting this to the Win32 Global-Shared site ?


One more question : where do you place the 'enableObject' procedure or the

do with frame {&FRAME-NAME}:
run SHAutoComplete(F_rep_batch:hwnd, 1) no-error.
end.



piece of code if you're not working with a SmartWindow, but just a simple Window ?
 
Good idea on global-shared. I submitted a program that implements the windows progress indicator (like the one IE uses when loading a web page) a while ago, but had forgotten about it. I have just sent an email to Jurjen so it should appear soon.

I don't use a normal windows a lot, but I would say you need to place the code in the main block, just after the "run Enable_UI." statement.
 
Right!

It works fine when the code is placed after the Run Enable_UI in the Main Block (for non SmartWindows).

One more question : I guess that, as it's a Windows-handled object, it is not possible to change the foreground and background colors of the drop-down list ?
 
Looks like the color is taken from the windows "Appearance" settings for "Active window".

I usually try to stick with the windows color schemes in most of my apps, otherwise they tend to look very non-standard.
 
Top