Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / Windows Menus Plugin

Author
Message
sicjoshsic
20
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 13th May 2003 23:10
is this for DBPro only?

Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th May 2003 00:47 Edited at: 14th May 2003 00:47
Yes, + DBEnhanced

It isn't a problem of trying to add a menu which is already present, I just mean where people put the menu creation code in functions for neatness or because they want to dynamically create the menus.

I believe that it may be to do with the actions which DBPro takes on returning from a function.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_101.zip
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th May 2003 00:55
I had more or less the same problem with my calloc plug-in - I suspect there is a bug in the code that creates functions...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th May 2003 01:49
Did you find a way to fix it, or should I email Lee?

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_101.zip
Evil Noodle
20
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 14th May 2003 03:30
Bugs or no Bugs nice work all the same, MrTatoad will be getting jealous

T.A.F.K.A.C.M.O.T.D
The Artist Formally Known As Cut_Me_Own_Throat_Dibbler
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th May 2003 11:21
I think it would be a good idea to E-Mail Lee - I got around it my just allocating memory once (probably more efficient anyway), which is something you cant do...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th May 2003 13:34
OK, I'll email Lee on this one.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_101.zip
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th May 2003 13:35
"MrTatoad will be getting jealous"

Toady's ego will take a lot of flak before it deflates

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_101.zip
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th May 2003 15:24
Rob, what calling convention are you/Delphi using?

DBPro uses/assumes the standard 'C' convention - which translates to arguments pushed onto the stack in reverse sequence, arguments are removed by the caller.
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th May 2003 16:48
Toady's ego will take a lot of flak before it deflates

Indeed it will.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th May 2003 17:26
@IanM

I am using the stdcall; convention, you need this otherwise Delphi DLLs don't always work. Toady experienced this though, and he programs in C++.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_101.zip
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 14th May 2003 20:31
It pains me to say it, but it might be worth trying it with subroutines...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th May 2003 21:14
Well there you go then.

stdcall is reverse sequence, but the function removes its own arguments. This could mean the the stack is being adjusted once by the function, and once by DBPro.

I don't know Delphi, but can't you specify that your functions use the C convention while still calling other types of functions? You can do this with VC++.
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th May 2003 21:54 Edited at: 14th May 2003 21:55
@IanM, I have the following options

Name------------Param Format----Clean-Up
===========================================
register--------Left-to-right---Routine
pascal----------Left-to-right---Routine
cdecl-----------Right-to-left---Caller
stdcall---------Right-to-left---Routine
safecall

I presume cdecl is the one I am supposed to be using?

Thanks for the info, I'll try cdecl and see what happens.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_101.zip
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th May 2003 22:13
Thanks IanM, it now works correctly, I'll upload a new version in a few minutes.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_101.zip
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th May 2003 01:28
Thats the one!
sicjoshsic
20
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 15th May 2003 21:10
can you please post some example source code for db enhanced, i can't get the example for dbpro to work

Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 16th May 2003 00:47
You must replace the commands as follows:

First

LOAD DLL "menusdll.dll",1

CREATE MENU "Menus" >> Call DLL 1,"CreateMenu","Menus"
DELETE MENU >> Call DLL 1,"TidyMenus"
ADD MAIN MENU "File" >> Call DLL 1,"AddMainMenuItem","File"
ADD MENU ITEM 1,"Exit" >> Call DLL 1,"AddSubMenuItem",1,"Exit"
GET MENU ITEM >> value=Call DLL(1,"SelectedMenuItem")
SET CHECKED 1,1 >> Call DLL 1,"SetChecked",1,1
SET VISIBLE 1,1 >> Call DLL 1,"SetVisible",1,1
SET ENABLED 1,1 >> Call DLL 1,"SetEnabled",1,1

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
sicjoshsic
20
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 16th May 2003 12:24
thank you, ive never used dlls in db before so i never knew how to do it propely. the db help files are rubbish!

Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 16th May 2003 17:14
" the db help files are rubbish!"

They are good enough to explain the usage of LOAD DLL and CALL DLL though.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 16th May 2003 22:21
But dont explain the problems with 64bit integers...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 16th May 2003 22:27
32bit integers should be enough for anyone

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 16th May 2003 23:24
You would think so, wouldn't you ?

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 17th May 2003 01:26
I thought Toady was above using numbers anyway. His DLLs work by using telepathy to transmit information to the calling program.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 17th May 2003 18:30
Actually, I use pigeons to pass data around...The advantage is, that if any data goes missing, I can blame them...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 18th May 2003 00:15
If Google use them, they can't be wrong.

http://www.google.com/technology/pigeonrank.html

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 18th May 2003 03:18
I wondered where Bob the pigeon got too - they took him.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 20th May 2003 11:44
hey Rob you might want to update you Signature
you only seem to have 1.02 on your site not 1.01 lol

i've noticed the same thing about the function calls though, i'm just not sure howto adjust VC++ to compensate ... well side from just saying bugger it and coding in C

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 20th May 2003 17:41
Sig updated.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 2nd Jun 2003 20:41
Great dll, I'll probably use it in my model viewer when I get back to it. Are you planning on adding seperators as raven mentioned?
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 2nd Jun 2003 22:56 Edited at: 2nd Jun 2003 23:03
[EDIT: For separator info, see below]

Note: You MUST use this plugin in Windowed Desktop mode, not Windowed Fullscreen. Although the two modes look identical, some users will experience problems in Windowed Fullscreen. Lee is looking at this for P5.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 2nd Jun 2003 23:02
@xtom

Just checked - you can already do splitters very easily, just set the caption to "-"

eg:

Add Menu Item 0,"-"

Will produce a splitter bar.

Splitter bars still count as menu items when using GET MENU ITEM(), so when working out the number for a certain menu item, include splitters.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 4th Jun 2003 00:51
Excellent
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 6th Jun 2003 00:01
Rob K, I've put your menu system into my program and it's pretty good and very easy to use too. But I'm getting some strange flickering on my views when I mouse over from menu to menu. I've uploaded it below if you want to have a look it in action. I added a wait command to fix the selection flicker but maybe you'd have an idea on what I could do to get rid of the mouse over menu flickering. It could be because of multiple cams I have or something. Hopefully it's something I can figure out cos I like the menus.


1.2mb rar file
http://gofree.indigo.ie/~xtom/files/3DOV_test.rar
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 6th Jun 2003 01:15
After messing about with the sync, lock backbuffer and lock pixels command I think I've found the best way to eliminate the annoying flicker I'm getting. I create a small bitmap and set it as the current bitmap while navigating the menu and then set current bitmap 0 when I'm out of the menus. It seems to be 100% flicker free and the menu graphics don't stick as they did when I tried locking the backbuffer. The trouble is finding out when the mouse is in the menus. I tried if mousey()<1 but if you move the mouse fast enough it'll hold a high value. Any chance of a menu active() command? It could report a 1 when the menus are in use and 0 when not?
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 6th Jun 2003 01:30 Edited at: 6th Jun 2003 01:36
The DBP program "freezes" when the menu is active. The best way to delay flickering is to add a delay if a menu item was clicked in that loop. I'll see if I can add a command to register when a menu loop is entered.


Are you using Patch 4.1?

I noticed in a menu demo released by GuyS using an earlier version of DBP that the menus did not clear when you moved from menu to menu, but under P4 / P4.1 I have not had this problem.

Thanks for posting the sample program, but I don't seem to get the flickering, although others have mentioned it. I'll try it on a few other PCs and see if I can replicate it.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 6th Jun 2003 02:48 Edited at: 6th Jun 2003 03:14
Yep I'm using patch 4.1. I've tested on 2 computers, one a laptop pentium with ati graphics and the other an amd pc with nvidia graphics. Both experience the flicker in the program I uploaded if you click on a menu and move left or right to display the different sub menus without even clicking. Sometimes it doesn't but mostly it does. Just to clarify that it's not the menus that flicker, they're perfect, it's the DB display. I can avoid it by freezing the screen with set current bitmap 1 while the user is in the menus but I need to know when the menus are in use or activated/deactived.

edit: Been messing about some more and noticed I get the same problem when clicking and draging the actual DB window around the screen. Sometimes it holds it's display and other times stuff dissapears. So it's not really a problem with the menus as I thought, it's more like activity outside of the db display area that's giving me the problem. Anyone know how to find out if the mouse is clicked outside the DB display area?
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 6th Jun 2003 08:05
xtom don't worry about the flicker, it isn't major and Rob's solution to it didn't help me either - personally i reckon the DLL and DBP sync is out, but thats just me.

you know you can't use multiple names either,
so if you do something like

create menu "DarkBASIC Pro"
add main menu "File"
add main menu "Help"
add menu item 0,"Open"
add menu item 0,"About"
add menu item 1,"About..."

the menu won't be created, just leave a blank screen - its confusing an odd why it does ... if i remember changing the name after you've made it works though

also if the screensaver comes on the entire DBP program will lock using the menu system - so i'd watch out.

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 6th Jun 2003 12:30
@Raven

That is to do with Delphi's object creation. TMenuItem objects' names are based on their first captions. So if you create one with the caption "About", that will be its internal name, and if you try to create another, it will not work (as two objects would have the same name). However, you can create it with a different caption eg "menuitem3" and then rename it using SET ITEM TEXT because the object's name internally is still "menuitem3".

"Anyone know how to find out if the mouse is clicked outside the DB display area?"

That is pretty difficult to do because you would have to subclass all the other running windows and find out if a mouseclick was made whilst a DBP program was active.

"personally i reckon the DLL and DBP sync is out, but thats just me."

It definately may be something to do with the sync command. As I said though, it is pretty difficult for me to debug as I can't reproduce the effect.

Still, glad to see my menu system being put to good use

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Jun 2003 16:00
mousex() and mousey() work outside of the dbp view if i remember because they're basically just point.x and point.y so you can just check it against the current veiw space and then you know that way.
i wish sometime that DBP has exclusive mode builtin

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 7th Jun 2003 16:41
Yes that's kinda like what I was trying Raven. Mousex() and mousey() hold their last value when the mouse leaves the DB display but mousemovex() and y still work so I was trying to do some sort of check to find if the mouse is clicked outside the window. Didn't get it working cleanly though. It would be handy if mousex() and mousey() returned -1 if the mouse was outside the window.
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Jun 2003 16:53
@Raven

I couldn't get MouseX() and MouseY() to work outside of the Window. Maybe it is just me.

There is a Windows API function to get this info, but Borland haven't updated the Windows API calling lib for this function so I have to do it manually (grr...)

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Jun 2003 02:21
alright well i'll add this support in my messagebox dll, set the positions call them desktop mouse x() and desktop mouse y() or something else, whatever you'd prefer ... its a very simple function in VC++

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 8th Jun 2003 04:52 Edited at: 8th Jun 2003 04:53
Until there's a better option I'm using the following code to lock my display while moving the window around or accessing the menus. And I'm also delaying the sync, can't rememeber why I'm doing that right now as I'm tired but it all works pretty good.

Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Jun 2003 18:48
interesting solution

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 12th Jun 2003 18:33
Thanks xtom

I've just finished adding a few bits and bobs:

- Radio items
- Sub items
- More flexibility in the set property commands
- Flag value of 2 alternates properties, so SET VISIBLE..2 would hide it if it was visible and show it if it was hidden
- Input Box
- Ability to read various item properties
- Menu items are now created with random internal names, so you can create two items with the same name without the problem of a conflict

However before I can get this lot working with DBP, I need to get optional parameters working.

For example, the SET VISIBLE command would now be as follows:

SET VISIBLE MainMenu,MenuItem,SubItem,Flag

I looked at the Basic2D commandset, where the DOT command has an optional parameter, and it looks something like this.

DOT%LL%Dot
DOT%LLD%Dot

I tried doing

SET CHECKED%LLL%SetCheckedMI
SET CHECKED%LLLL%SetCheckedSI

but it complains of a duplicate command... grrr.

Does anyone know how to deal with this?

I could create three seperate commands depending on which level of menu item you wanted to change, but I thought this would be a bit messy. Getting a handle to the item is another possibility but that would be un-DBP like and confusing. Sigh.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 12th Jun 2003 19:31
EDIT: Nevermind, a bug in my code. I think I will go and steal Toady's halo of perfection

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 12th Jun 2003 22:06
Sounds good, will definately give it a try when it's ready.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2003 00:47
I assume that means you got it working Rob. I've got the same sort of thing working myself - min() and max() for all types
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 13th Jun 2003 14:15
Yes, thanks IanM. I was originally going to have say 3 different functions depending on which level of menu item you wanted to change, but I steamlined it to make it easier for the user.

I'm a tad depressed atm. so I need a session of coding to cheer me up. I'll release the new build asap folks

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip

Login to post a reply

Server time is: 2024-04-24 02:39:30
Your offset time is: 2024-04-24 02:39:30