| View previous topic :: View next topic |
| Author |
Message |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Fri Sep 19, 2003 3:09 pm Post subject: |
|
|
I've made a change so that if you do a DIALOG ADD,MENU,&File with no subitems, you get a FileMENU event when the menu bar item is clicked. I've modified your example and it works a treat. I use the position of a hidden dummy button at 0,0,1,1 to get the top and absolute left co-ordinates for the menu, and add a fixed offset from there. It doesn't solve the problem of hotkeys, but it does look a bit more normal.
Both these changes were trivial to do, since they basically just involved making use of code that was already in there. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Fri Sep 19, 2003 5:11 pm Post subject: |
|
|
Okay another update: 1.9.19.2003.
- Added ability to use icons from within exe, dll's by specifying icon index.
Remember since this dll uses the | to seperate menu items that you have to use the / character when pulling resources from dsr or a icon index:
ex: POPUP &File;;myexe.exe/3
The above would pull the icon with index 3 from the exe and display it.
Also thank you very much Jules That is extremely helpful and much better then having to using the DESIGN style which causes everything to generate a click (while this can be parsed to only capture menus it unnecessarily causes events to be generated). I really appreciate you looking out for dll developers like this.
As for getting the position of the menu's you can use this api, currently in Delphi syntax however I'm sure it can be used in vds with some conversion:
| Code: |
var
WindowHandle: HWND;
MenuHandle: HMENU;
MenuRect: TRect;
begin
// Get The Window Handle for the window with class name
// TestExample, then get the mainmenu handle from that.
// Note the two functions below GetMenu and
// GetMenuItemRect are api's called from USER32.DLL
WindowHandle := FindWindow(PChar('TestExample'), nil);
MenuHandle := GetMenu(WindowHandle);
// Get the position of the menu with index 0, we won't
// get the rest since this is just an example
GetMenuItemRect(WindowHandle, MenuHandle, 0, MenuRect);
// MenuRect.Left Holds left position of menu
// MenuRect.Bottom Hold bottom position of menu
|
The rect will hold the top, left, right and bottom values and are absolute screen coordinates of the menu item you are querying. The values really needed are the left and bottom coordinates of the menu so you can pass this to the popup to display directly under the menu.
The above example assumes you have a window already opened with the class name 'TestExample' and with a menu on it. |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Fri Sep 19, 2003 6:08 pm Post subject: |
|
|
I'll give this a try when I get a chance, but I'm packing up for the week now. I'll be interested to see how your code renders a 16x16 bitmap if there is only a 32x32 icon to work with. I spent quite a lot of time searching the Internet and trying different things to get the code that is now in VDS 5, which does a much better job of making a 16x16 image than the plain API code did.
The big problem for menu bars seems to be that if you click on one menu and then slide the pointer to the next one the popup menu doesn't close and open the next one like "real" menus do (presumably because the popup and not the menu bar has the focus.) I can't think of a workaround for that one. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Fri Sep 19, 2003 7:17 pm Post subject: |
|
|
I'm using the Api ExtractIconEx to get the smallicon out. If there is no such small icon it will pull out any icon available and display it.
That api is only used to pull icons with an index and not for icons within dsr, actual icon file or exe embedded binary type resource.
Then all icon are directly loaded into a TIcon and then converted with the win api, building a device context, setting bitblt and then assigning the Device Context to a TBitmap. This preserves the icon size and transparency. If I used standard TIcon > TBitmap canvas drawing the icon would always had been 32x32 thus the reason for using DC's.
Currently I'm not restricting the POPUP's icons to 16x16 since the popup can display much larger images. I think the POPUP is able to display images up to 48x48. This way you can build a Windows XP style type start menu if you so choose.
However if I ever did need to restrict size a decent way is to paint the TIcon over to a TImage canvas and set the property of STRETCH to true. You can then resize the image up or down. Not the best method since it then requires the Controls unit to be added, which adds to the size.
Back to vdspoup >
Yes your right that sliding position will be a problem. It seems moreso that the script halts when you show any kind of POPUP until the POPUP disappears. I don't see anyway around this really since even mouseover can't be intercepts and processed when the script is in a halted state like this.
Hotkey's wont be such a problem, I noticed you and codescript stumbled upon a method in another thread on how to capture keystrokes for local hotkeys, I'll try to come up with something in regards to this - dsu type unit. |
|
| Back to top |
|
 |
Rebel49 Contributor


Joined: 23 Aug 2002 Posts: 78 Location: Nova Scotia, Canada
|
Posted: Mon Sep 22, 2003 11:19 pm Post subject: |
|
|
Hi Pgware!
You said in your original release annoucement.
| Quote: |
The dll is sharware - $20 US one time fee.
|
Do I understand the license agreement correctly
that I would not be able to include the DLL in a distributed
VDS program?
REB _________________ OLD and eager! |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Sep 22, 2003 11:23 pm Post subject: |
|
|
I think he meant you only have to pay one fee of $20.00 USD and you can
distribute it as much as you want.
You might be getting this confused with the discussion about a CD Burning
component. _________________ FreezingFire
VDSWORLD.com
Site Admin Team
Last edited by FreezingFire on Tue Sep 23, 2003 12:01 am; edited 1 time in total |
|
| Back to top |
|
 |
Rebel49 Contributor


Joined: 23 Aug 2002 Posts: 78 Location: Nova Scotia, Canada
|
Posted: Mon Sep 22, 2003 11:33 pm Post subject: |
|
|
Well, the cd burning discussion did get me a thinkin'
but this is how the license reads! Sounds like 1 license per
machine running it doesn"t it ?????
But I (get) confuse(d) easily sometimes.
"
2. GRANT OF LICENSE. You must enable the license for the Software by entering the registration number/keyfile as prompted by the Software. The term of the license is perpetual. You may use the Software on that number of computers for which you have purchased a separate license as indicated on the invoice or sales receipt. You may also make one copy of the Software for back-up or archival purposes. You agree to use the software solely and exclusively for the purposes of evaluation, for a period of not exceeding 28 days. On the expiry of this period, or when you have completed your evaluation (whichever comes first) you agree to either a) obtain a full license for the software, or b) cease using the software and to delete all the installed copies of the software that you have made.
"
REB _________________ OLD and eager! |
|
| Back to top |
|
 |
LOBO Valued Contributor


Joined: 14 Mar 2002 Posts: 241 Location: Wilmington, Delaware, USA
|
Posted: Mon Sep 22, 2003 11:55 pm Post subject: |
|
|
Reb,
I do believe that is meant for devloping with the dll. If you purchase 1 license you can only use the dll on one devloping machine. I'm sure Prakash will reply to this thread and let us know but you are right the way it reads it could be very confusing.
- Mark |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Tue Sep 23, 2003 12:05 am Post subject: |
|
|
The dll is indeed licensed for each development machine - you must pay per machine you intend to develop with the dll.
You can deploy the dll with your programs on as many machines without any charge.
The license only pertains to development with the dll per machine. This protects the dll from being licensed once and being used in a program which allows development of a custom popup to be called and used for other programs. |
|
| Back to top |
|
 |
Rebel49 Contributor


Joined: 23 Aug 2002 Posts: 78 Location: Nova Scotia, Canada
|
Posted: Tue Sep 23, 2003 12:09 am Post subject: |
|
|
Then I guess I did misunderstand!
Thanks for the clarification
REB _________________ OLD and eager! |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Sat Sep 27, 2003 11:45 pm Post subject: |
|
|
| In case you haven't noticed, I uploaded a new version yesterday to address problems with some resources not being destroyed correctly, this caused the dll to crash. This should be fixed now. Download the update - 1.9.26.2003 |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Mon Sep 29, 2003 10:06 pm Post subject: |
|
|
Another update today, this update resolves all known problems with the dll crashing on Windows 95, 98, Me machines.
You should download this update if you use this dll!!
The problem was when you passed it a file that was already opened in memory (dll, exe, etc - usually system related files) and tried to load an icon from it, the file would be closed off from access from other programs and would cause a KERNEL32.DLL error. This was fixed after numerous hours of me and Chris finding what the problem was, one line fix
DOWNLOAD UPDATE HERE - VERSION 1.9.29.2003 |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Tue Sep 30, 2003 4:36 am Post subject: |
|
|
I finally got around to converting the api into vds syntax VDS 5 or HIGHER ONLY:
| Code: |
:GETMENUPOS
LOADLIB user32.dll
%%WindowHandle = @strdel(@winexists(@dlgtext()),1,1)
%%MenuHandle = @lib(user32.dll, GetMenu, INT:, %%WindowHandle)
%A = @binary(dword,0)@binary(dword,0)@binary(dword,0)@binary(dword,0)
if @lib(user32.dll, GetMenuItemRect, INT:, %%WindowHandle, %%MenuHandle, %1, @addr("%A"))
%%left = @val(@substr(%A,1,4))
%%bottom = @val(@substr(%A,13,16))
else
%%left = @mousepos(X)
%%bottom = @mousepos(Y)
end
FREELIB user32.dll
exit %%left|%%bottom
|
What this code/function above does is finds the left and bottom coordinates of a menu item. Of course you need a menu on your dialog for this to work. This allows you to show a custom popup menu right below the menu item
In your code after an event from one of the main menus, you can execute the function:
| Code: |
parse "%X;%Y", @GETMENUPOS(0)
popup hello,%X,%Y
|
the @GETMENUPOS() function is defined above, and you simply pass the menu item #, menu items start at 0. You would then use @getmenupos(1) to get the second menu item, etc. |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Oct 03, 2003 6:57 pm Post subject: |
|
|
Prakash, I think I found a 'bug'. When you make a popup window like this:
| Code: | | popup &New|&Open|&Save,10,10 |
And you press the 'Save' item (or one of the others), they event will be named '&SaveMENU'. Maybe you should remove the & from the event name? Cause that is how VDS does it...  _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Fri Oct 03, 2003 7:27 pm Post subject: |
|
|
| Not really a bug, I probably will remove the & signs on the event trigger however. I figured it wouldn't really be that much of a deal for a user to include & as part an event label. |
|
| Back to top |
|
 |
|