Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to allow user to select a folder?
#1
Is there an easy way to have the user select from a list of folders? I know how to generate the list: I just don't understand how to have the user select from that list.

Thanks!

Smile

Jon
#2
How do you generate the list? Show the code.
#3
; list directories
out "list directories"
lpstr d=dir("C:\Rhoads\Verichem Web Site\*" 1)
rep
if(d = 0) break
out d
d = dir("" 1)
#4
Can be used menu?

This menu shows all folders in C:\Rhoads\Verichem Web Site:
Code:
Copy      Help
;/expandfolders 0x30 0
pf "C:\Rhoads\Verichem Web Site"
#5
Thanks for your help.

"pf" cannot be found in the Help under File. It cannot be located in the Index. A Search for it fails. So I have NO idea what you are doing with this code. Which leaves me helpless. If I omit the "comment" above the "pf", it fails to compile. With the "comment", it compiles but does not work. Nothing happens (pops up). Very confusing.

What happens on your system? What should happen here?

Thanks again...

Smile

Jon
#6
Create new menu and paste the code. The menu shows all subfolders. The "pf" is just menu label, and in this case is not used and can be deleted.
Code:
Copy      Help
;/expandfolders 0x30 0
"C:\Rhoads\Verichem Web Site"

In Properties you can modify it to behave more like you need. You also can run the menu from a macro using mac (read Help).
#7
Much better! Thank you! Sorry for being so clueless...

How can I see the folder that the user selected from within the macro? I want that string (folder name) returned to the place in the macro where the menu is invoked. The value of the "mac" command seems to be -1.

Also, is there any way to eliminate all of the "This Folder" icons? I just want a simple list of folders, and have the user pick one.

Thanks again!

Smile

Jon
#8
Use function GetLastSelectedMenuItem. To read more click the 'read more' link in mac help.

Quote:is there any way to eliminate all of the "This Folder" icons?

Remove the flag in Properties. But then must be set level 1, ie no subfolders.

Code:
Copy      Help
;/expandfolders 0x10 1
"c:\program files"

------

Or instead of menu you can use function BrowseForFolder.
#9
Thanks again.

It would be VERY helpful if the information provided in the "DLL Functions Exported By QM" article were alphabetized. It is time consuming to have to read the entire list looking for a single item. Maybe you can provide an alphabetized list at the top, linking down to the actual detailed information.

The calling sequence for GetLastSelectedMenuItem is not provided anywhere. When I enter it in the editor, I see the parameters are Label, Command, and Flags, but I have no idea what that means. There are no examples using this function.

I have no idea what the hex values that you keep providing mean, so I don't know how to control them Are they documented somewhere?

When you say "must be set level 1, ie no subfolders", do you mean that I can't see the content of a folder on a path like "C:\fred\alice\jane", or I can see that, but cannot expand folders? If the former, this constraint makes this solution unworkable for me: I can't constrain the user in this way.

I keep trying to combine the various properties/flags, but the behavior is confusing.

Jon
#10
Yes I should sort or split the qm dll functions topic. Never thought that the list will become so long. The example is at the end of the topic. I should move it to the function's description.

Here is the example:
Code:
Copy      Help
if(mac("Menu name"))
,str s
,GetLastSelectedMenuItem 0 &s 0
,mes s

When you set 1 level, the user can click folders to open them, but the menu does not have submenus. If you don't set level limit, then the menu has submenus but the user cannot click to open folders that have subfolders. For this purpose can be used 'Open this folder'.

Quote:what the hex values that you keep providing mean

What hex values? Maybe those documented in 'Menu properties' topic in help. Press F1 or click ? in Properties -> Menu Properties.
#11
Thank you! All set! It works nicely now!

Smile

Jon


Forum Jump:


Users browsing this thread: 1 Guest(s)