IonicWind Software

Treasure Chest => Shared INC's and LIB's => Topic started by: Andy on January 20, 2018, 05:09:11 AM

Title: Custom menu with or without a custom window
Post by: Andy on January 20, 2018, 05:09:11 AM
Please go to the end of this thread for the latest version (V4 part 2 download).


As time has gone on, it was clear that most of the work I was doing was with making a custom menu.

So this is a new post, it concentrates on giving you a custom built menu for a normal window, as well as a custom window.

What's new here? - well a lot.

You can use this menu with normal windows.
A help file is included.
Menu popup titles are highlighted when popup items are displayed.
You can change a lot of the default settings.
Each group of menu items will change it's length depending on if you have check boxes / radio buttons, and shortcut text.
You can set font styles.
You can change item text and shortcut text.
You can change the highlight colour.
You can change the menu item text colour.
You can change the menu item background colour.

Unzip the files to a folder, and as always,

copy the .inc files to your C:\IWBDev3\Include folder and
copy the .lib files to your C:\IWBDev3\Libs folder

A good to go for all I think.

Enjoy.

Andy.
:)


Title: Re: Custom menu V2 - Popup within a popup
Post by: Andy on January 28, 2018, 06:08:46 AM
Well I managed to create a popup within a popup for both normal and custom windows (windows without a max box).

Normalwindow8.iwb - for a normal window (attached).
Customwindowrelease8.iwb - for a custom window (attached).

The code looks like this:


MyMenuTitle("Project",50,0,0,0,rgb(250,128,114))
'Optional - 0,0,0 - use default colours except when mouse is over control - change background colour.

MySeparator(51,rgb(100,149,237)) 'A separator give a nice edge to the start of a group of menu items.
MyMenuItem("PItem1","",52,hIcon,1)
' 1 donotes a checkbox.

MyPopupTitle("PPopup",53)
MyPopupSeparator(54)
MyPopupItem("PPopup 1","",55)
MyPopupItem("PPopup 2","",56)
MyPopupItem("PPopup 3","Ctrl+P",57)
MyPopupSeparator(58)
MyPopupEnd()

MyPopupTitle("PPopup2",60,hIcon2)
MyPopupSeparator(61)
MyPopupItem("PPopup 21","",62)
MyPopupItem("PPopup 22","",63,0,0,rgb(128,128,0),rgb(211,211,211))
MyPopupItem("PPopup 23","",64)
MyPopupSeparator(65)
MyPopupEnd()

MyMenuItem("PItem2","",66)

MyPopupTitle2("POP4","MyShortcut",67,hIcon)
MyPopupSeparator2(68)
MyPopupItem2("Pop4 - 1","Ctrl+F",69,hIcon2,1)
MyPopupSeparator2(70)
MyPopupItem2("Pop4 - 2","Ctrl+X",71,hIcon,0)
MyPopupSeparator2(72)
MyPopupEnd2()

MyMenuItem("PItem3","End",73)
MyMenuEnd(w1)


The new commands are:

MyPopupTitle2
MyPopupSeparator2
MyPopupItem2
MyPopupEnd2

They have the same options as the original commands, e.g. MyPopupTitle2 has the same options as MyPopupTitle, and so on.

I am now working on inserting new menu items / deleting existing ones etc plus a little tidy up.

I Wanted to post this so hopefully someone will give me a little feedback.

Trust me - a popup with a popup was not easy!!!!

If you like these custom menus (and I think you'll find these a great benefit) - download it please so you keep up to date with what I'm posting.

Unzip the files to a folder, and as always,

copy the .inc files to your C:\IWBDev3\Include folder and
copy the .lib files to your C:\IWBDev3\Libs folder

See attached.

Thanks,
Andy.
Title: Re: Custom menu V2 - note.
Post by: Andy on January 30, 2018, 06:54:49 AM
I forgot to say, I've also cleaned up the include file that comes with it, so it should be much easier to read and understand.

Here is the section where you can see / change the default settings:

'========================================================================================
'
' Default menu & menu titles settings.
'
'========================================================================================

cwMenuItm           = cwPictureHeight  'Menu down starting position.
cwItemsDownOffset   = 0                'Menu down starting position offset.
cwItemsAcrossOffset = 0                'Menu across starting position offset.
cwDefaultTextSize   = 10               'Default Menu Title / Menu item / Popup text font height.
cwDefaultTextFont   = "Arial"          'Default Menu Title / Menu item / Popup text font.
cwDefaultHFC        = rgb(0,0,0)       'Default Menu Title Highlighted foreground colour.
cwDefaultHBC        = rgb(135,206,250) 'Default Menu Title Highlighted Background colour.

'========================================================================================
'
' Default menu item (including popup titles & popups) settings.
'
'========================================================================================

'Each menu item consists of these components (in order and excluding the item text itself):

cwSpacerSize   = 10  'Indentation width before icons.
cwIconSize     = 20  'Icon width.
cwStyleSize    = 20  'Width of checkbox / radiobuttons.
cwStylePad     = 10  'Width after checkbox / radiobutton.
cwPadding      = 20  'Width of shortcut text size.
cwShortcutSize = 80  'Width of shortcut text.
cwRightPad     = 10  'Width after shortcut text.

cwItemHeight   = 20  'Height of menu items / popup titles / popup items.
cwPopupSymbol  = ">" 'Popup title symbol.

cwDefaultItemBackgroundColor = RGB(211,211,211) 'Default menu item background color (non-highligthed).
cwDefaultItemForegroundColor = RGB(1,0,0)       'Default menu item text color (non-highligthed).
cwDefaultItemFHighlightColor = rgb(255,0,0)     'Default menu item text highlight color.
cwDefaultItemBHighlightColor = rgb(135,206,250) 'Default menu item highlight color.
cwDefaultSeparatorColor      = rgb(180,180,180) 'Default separator colour.

'========================================================================================
'
' End of default settings.
'
'========================================================================================


As said in the last post, I'm working now on inserting / deleting menu items plus adjusting the length of each block of items in relation to whether they have checkboxes / shortcuts etc or not.

Think it will look very nice when I've finished.

Thanks,
Andy.
:)
Title: Custom menu V2 - New update.
Post by: Andy on February 04, 2018, 03:35:27 AM
400 reasons why you should download this update - well that's the number of hours it's taken to get here, all done in my spare time, and free to you!

I've added in some new commands, functions plus other things with this update, they are as follows:

You can now change icons.
You can set the shortcut font, colour, size and weight.
You can do the same for the menu item's text.
You can now insert a menu item (not popups yet).
I've updated the help file with the new commands, and made it easier to read.
I've also re-worked the example in the help file.
Added in a FAQ section to help with simple problems / mistakes (even I was making sometimes).
I've corrected a little alignment problem.

Also, when you are over a popup item, its popup title now remains highlighted which looks better.

With these example programs, I'm showing you how to change icons, text / shortcut text styles, colours, sizes and weights. How to deal with items being clicked / checkboxes being ticked / un-ticked etc.

Look around the menu items in the example program and see what's being set and how, also check out:

Edit / EPopupT1 / POP1 / Click me!!! (and give it a click).

The custom menu works with both normal and custom windows as stated before.

I've really re-invented the wheel with custom menus, it's simply down to you to read, experiment and hopefully use it when you find a need for it.

I'm giving you the tools to do this, it's just down to your imagination now.

Brian,
You sold me a good one with this! didn't think it would be that hard to do (how wrong was I!).

Anyway, enjoy every one!

As always,

copy the .inc files to your C:\IWBDev3\Include folder and
copy the .lib files to your C:\IWBDev3\Libs folder
(overwrite any existing versions).

Attached is the V2 update.

Andy.
:)
Title: Custom menu V2 - New update note.
Post by: Andy on February 09, 2018, 05:47:25 AM
I now have added in the ability to:

Add in a pop up item, and a pop up 2 item (a pop up item within a pop up).
Also, I've documented the new commands in the help file.

I also noticed that the green tick icon was not vertically centered, this has also now been fixed, so any icon you use will always appear centered.

I will release this (what I think will be the final version) soon - when I've done more testing, unless any one else has any more ideas / wish list.

The V2 update has had a good download rate - thank you!

Just wondering now, if I need to add a deleting items command, or would disabling them be good enough?

What does any one think on it please?

Andy.
:)
Title: Custom menu V4 Coming soon.
Post by: Andy on February 10, 2018, 06:49:26 AM
Just a little update on progress.

Version 4 of the custom menu will be released soon.

Hopefully I will have the delete commands in there so you will be able to delete a menu item, a pop up title, and a pop up 2 title (plus their corresponding items).

I will also be showing you how to get real time information from the library, which will tell you:

If the menu is open.
What menu item you are over.
What pop up title is open.
What pop up 2 title is open.

As said before, version 4 will be the final version - I know you'll find it useful, so when I release it, keep it in your pocket.

If I add in my mouse over controls code (which is included in each release of the custom nenu), it's probably around 1,000 hours of work in total - and I'm not kidding on that.

See attached image.

Thanks,
Andy.


Title: Custom menu V4 download here...
Post by: Andy on February 11, 2018, 04:26:47 AM
Well,

As promised version 4 of my custom menu is here, I don't think I'll be making anymore major changes so this will be the final version of it (although I might just add a little to it in time).

What's in this version?

Well you can now delete a menu item.
Delete a pop up item.
Delete a pop up 2 item.
Delete a pop up title (and all of it's menu items).
Delete a pop up 2 title (and all of it's menu items).
Adding in items now have the command name MyNew.... which makes it easier to understand.
The help file has been updated with the new commands and some new information on how to get data direct from the library file.

The two example programs have been re-worked to show you all the functions of the library including real time menu data (which could be very helpful) including a new menu title 'Help' which will open the help file for you if you want.

The deleting of items was actually less of a problem than I first thought (for once) so I was able to finish it off this morning.

I've put in some error checking in so that if you delete a pop up title and then try to add an item to it later it won't allow it.

Well, I hope you've all found this custom menu interesting, I've done it for the pleasure, but also in the hope someone somewhere might actually use it as some point - hope you do.

Anyway, even if you can't see a need for it at the moment I hope you download a copy - you never know it might just come in handy one day.

It's free from me, so why not!

As always,

copy the .inc files to your C:\IWBDev3\Include folder and
copy the .lib file to your C:\IWBDev3\Libs folder
(overwrite any existing versions / files).

Thanks for reading this and enjoy!

Andy.
:)
Title: Custom menu V4 part 2 coming soon
Post by: Andy on February 25, 2018, 05:35:11 AM
Well,

I promised version 4 of the custom menu would be my last offering of it, but I've found some more time to work on it, and speed up / add in new features as version 4 had a good download - thanks everyone!

So I will be releasing version 4.2 in a few days time.

Here are the changes / additions:

1. The ability to add new pop up titles plus new popup items for it.
2. You will be able to add in separators for existing menus / new ones.
3. The addition of new items either way is now much much faster.

In version 4, I was destroying all the existing items, then re-creating them plus adding in the new ones. In version 4.2 it's now done differently, instead of doing it that way I realised all that was needed was to use the SETSIZE command to re-position existing items to make room for any new ones.

This method is much faster.

I am now working on the deleting side of items, which will work in the same way, so now you'll be able to add / delete items on mass.


case 107 'Add a popup item.
        if @NOTIFYCODE = 0
           MyNewPopupItem(w1,14,"New Popup item 1","ABCD",802,1)
           MyNewPopSeparator(w1,14,803,4)
           MyNewPopupItem(w1,14,"New Popup item 2","XYZ",804,4)
           MyNewPopSeparator(w1,14,805,5)
           setfocus w1
        endif

case 108 'Add a popup2 item.
        if @NOTIFYCODE = 0
           MyNewPop2Separator(w1,23,806,2)
           MyNewPopup2Item(w1,23,"New 2 item 1","1234",807,2)
           MyNewPop2Separator(w1,23,808,2)
           MyNewPop2Separator(w1,23,809,5)
           MyNewPopup2Item(w1,23,"New 2 item 2","Ctrl+P+2",810,5)
           MyNewPopup2Item(w1,23,"New 2 item 4","Ctrl+P+4",811,6)
           MyNewPopup2Item(w1,70,"New Pop4 item 1","QWERTY",812,2)
           MyNewPopup2Item(w1,70,"New Pop4 item 2","Q+X",813,3)
           MyNewPop2Separator(w1,70,814,2)
           MyNewPop2Separator(w1,70,815,3)
           setfocus w1
      endif
   

If you like the custom menu, then please download it when I release it.

This will be much better, and really finishes off the custom menu library, and I will release it a.s.a.p.

Thanks,
Andy.

Title: Custom menu V4 part 2 download here.
Post by: Andy on March 02, 2018, 06:44:25 AM
This will be the final version of the custom menu.

I know I've said that before, but this really will be it (unless any bugs are found).

So what's in this final version, and why should you get a copy?

1. It's free - the best reason of all!
2. Unless you've got a lot of time on your hands, I wouldn't attempt it - seriously - talk about hard work.
3. Adding new items / deleting existing ones is now much much faster.
4. You can add / delete items on mass and in any order.
5. You can also add new separators into any menu / pop up title etc.
6. As before, you can change the fonts, styles of either the menu item's description or the shortcut text.
7. You can easily add an icon to an item.
8. Change the icon.
9. Change the font / style at any time.
10. Error checking has been added - many times during testing I (by mistake) re-used an existing control Id.  Now if you do that whilst adding to an existing menu you will be give an error message on compile.
11. Error checking for existing menus / titles is also in place.
12. The above error messages can be turned off if you don't want them.
13. When moving off then back onto the menu highlight is now fixed.
14. You can now click anywhere on screen with the menu open to simply close it.
15. I've simplified things, so there are less commands you need to use.

Note, line 455 in the example program - the comment should read
'cwPrevH is the previously highlighted menu item.

I've updated the help file as always.

Brian (and anyone else), I've only included a normal window example - if you'd like a custom window example (one without a max box) please just message me.

Oh, and reason 16, I need to get a life!!!!

Have a good look through the example program, look through the custom window include file, and yes, have a read of the help file.

You really only need to do seven simple steps to create a custom menu of your own.

As always,

copy the .inc files to your C:\IWBDev3\Include folder and
copy the .lib file to your C:\IWBDev3\Libs folder
(overwrite any existing versions / files).

You can delete any older custom window inc and lib files.

Thanks for reading this, download and enjoy!
Andy.
:)




Title: Custom menu v4.2 Footnote
Post by: Andy on March 07, 2018, 07:00:00 AM
I noticed one glaring omission to all previous versions, and it was this:

No ability to add in a new pop up title / items
No ability to ad in a new pop up 2 title / items (a pop up within a pop up).

I only reaslised it after releasing version 4.2 - sorry folks  :'(.

But I hope you all understand how big a job this has been, and we all can use this library - so it's worth it.

I have now corrected the above omissions, and I'm just working on sizing the new items, when I've done that, I can release it (and then go back to bed!!!!).

See attached screenshot.

Andy.
:)