 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
La Mygale Guest
|
Posted: Thu Jan 12, 2006 2:12 pm Post subject: Windows Popup Menu |
|
|
Hi people.
In a listbox showing file names, I would like a right-click to open a
popup menu similar to the Windows explorer popup menu (the one with
Open, Open with..., Send to, Copy, Paste, etc).
How can I do that ?
Thank you
LM
|
|
| Back to top |
|
 |
Tom de Neef Guest
|
Posted: Thu Jan 12, 2006 2:38 pm Post subject: Re: Windows Popup Menu |
|
|
"La Mygale" <nospam (AT) sorry (DOT) org> schreef in bericht
news:1137075136.711570 (AT) News (DOT) univ-nantes.fr...
| Quote: | Hi people.
In a listbox showing file names, I would like a right-click to open a
popup menu similar to the Windows explorer popup menu (the one with Open,
Open with..., Send to, Copy, Paste, etc).
How can I do that ?
Thank you
LM
|
1) create the popup, add the entries you wish
2) double-click each entry in turn: this will generate a handler for the
on-click event; you can also route the clicks of all items to one event
handler. Sender will tell you which menuitem triggered.
3) in the eventhandler, determine which line of the listbox was selected.
The popup has properties for this: PopupComponent tells which component the
popup was over (if PopupComponent IS Tlistbox then with PopupComponent AS
Tlistbox do ... either refer to itemindex or to selected).
The PopupPoint property indicates x and y (in screen coordinates) of the
calling point. But I don't think you need those. If you do, you'll have to
determine x,y offset of the listbox and the lineheight.
Tom
|
|
| Back to top |
|
 |
La Mygale Guest
|
Posted: Thu Jan 12, 2006 3:09 pm Post subject: Re: Windows Popup Menu |
|
|
Tom de Neef a écrit :
| Quote: | 1) create the popup, add the entries you wish
2) double-click each entry in turn: this will generate a handler for the
on-click event; you can also route the clicks of all items to one event
handler. Sender will tell you which menuitem triggered.
3) in the eventhandler, determine which line of the listbox was selected.
The popup has properties for this: PopupComponent tells which component the
popup was over (if PopupComponent IS Tlistbox then with PopupComponent AS
Tlistbox do ... either refer to itemindex or to selected).
The PopupPoint property indicates x and y (in screen coordinates) of the
calling point. But I don't think you need those. If you do, you'll have to
determine x,y offset of the listbox and the lineheight.
Tom
|
Thanks you Tom.
But err... my question must have been bad written. I don't want my popup
menu to be "my" menu but THE Windows Explorer Popup File Menu, the one
with the usual items (Open, Rename, Copy, Paste, Send to, etc.) and the
specific items depending on file types (eg. "Extract to" for a zip file,
"View" for a a bmp file, etc.) or specific installed applications. I
looked in the Registry for this kind of key but I found nothing.
Sorry for my mis-writing.
LM
|
|
| Back to top |
|
 |
Maarten Wiltink Guest
|
Posted: Thu Jan 12, 2006 3:39 pm Post subject: Re: Windows Popup Menu |
|
|
"La Mygale" <nospam (AT) sorry (DOT) org> wrote
| Quote: | [...] I don't want my popup
menu to be "my" menu but THE Windows Explorer Popup File Menu,
|
Do you actually want the Explorer's menu, or one of your own that looks
just like it? The latter is quite hard enough; the former should by rights
be impossible - which means it may just be dead easy if you know exactly
where to look.
| Quote: | the one
with the usual items (Open, Rename, Copy, Paste, Send to, etc.) and the
specific items depending on file types (eg. "Extract to" for a zip file,
"View" for a a bmp file, etc.) or specific installed applications. I
looked in the Registry for this kind of key but I found nothing.
|
The HKCR hive is full of it. Unfortunately, it's spread over at least
three or four different mechanisms by now. The oldest, simplest one
starts with a key for the extension that has a pointer to the type,
and keys with menu captions and commands under the type's Shell subkey.
But that's too simple for these modern times of per-user customisation,
so it was modified and extended clear out of recognisable reality. And
then there are the other schemes.
Groetjes,
Maarten Wiltink
|
|
| Back to top |
|
 |
Rob Kennedy Guest
|
Posted: Thu Jan 12, 2006 5:05 pm Post subject: Re: Windows Popup Menu |
|
|
La Mygale wrote:
| Quote: | In a listbox showing file names, I would like a right-click to open a
popup menu similar to the Windows explorer popup menu (the one with
Open, Open with..., Send to, Copy, Paste, etc).
How can I do that ?
|
Have you seen Virtual Shell Tools? It's free, and it might just handle
everything you need. It can generate the context menu for a file or
group of files. It can also display a directory full of files, along
with their associated icons.
http://www.mustangpeak.net/
--
Rob
|
|
| Back to top |
|
 |
La Mygale Guest
|
Posted: Thu Jan 12, 2006 5:34 pm Post subject: Re: Windows Popup Menu |
|
|
Maarten Wiltink a écrit :
| Quote: | [...] I don't want my popup
menu to be "my" menu but THE Windows Explorer Popup File Menu,
Do you actually want the Explorer's menu,
|
Yes sir ! The Popup File Menu.
| Quote: | the former should by rights be impossible - which means it may just be dead easy if you know exactly
where to look.
|
That's what I guessed...
The kind of API Call or SendMessage or whatever which is documented
nowhere...
Looks like I'll have to type lines and lines of code and use lots
ressources to reinvent the wheel.
Thanks for your answer anyway.
LM
|
|
| Back to top |
|
 |
Hans-Peter Diettrich Guest
|
Posted: Fri Jan 13, 2006 1:37 am Post subject: Re: Windows Popup Menu |
|
|
La Mygale schrieb:
| Quote: | That's what I guessed...
The kind of API Call or SendMessage or whatever which is documented
nowhere...
|
You cannot expect that every feature of a MS program (like Explorer) is
an API function. Since MS software typically is not open source, you'll
have to guess how something is done, in most cases. If you want more
transparency, you should choose a more appropriate platform for your
development, like Linux...
DoDi
|
|
| Back to top |
|
 |
La Mygale Guest
|
Posted: Fri Jan 13, 2006 10:15 pm Post subject: Re: Windows Popup Menu |
|
|
Rob Kennedy a écrit :
| Quote: |
Have you seen Virtual Shell Tools?
|
Great tools indeed.
Thanks for the tip
LM
|
|
| Back to top |
|
 |
La Mygale Guest
|
Posted: Fri Jan 13, 2006 10:21 pm Post subject: Re: Windows Popup Menu |
|
|
Hans-Peter Diettrich a écrit :
| Quote: | La Mygale schrieb:
That's what I guessed...
The kind of API Call or SendMessage or whatever which is documented
nowhere...
You cannot expect that every feature of a MS program (like Explorer) is
an API function.
|
You're right, but Delphi provides an example : "ShellListView" which
probably uses some MS stuff (and the famous RightClick on files).
LM
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|