-
Re: Mouseover highlights label text - how?
Can I get the correct method to load these controls into my project please?
I currently copy MenuLabel.ctl and TransContainer.ctl into the folder I am working in that contains my forms. I select Project, then Add User Control and navigate to MenuLabel.ctl. I repeat for TransContainer.ctl. I double click the icon and get an 'error during load' Msgbox. In the menulabel.log:
"Line 11: Property ToolboxBitmap in MenuLabel had an invalid file reference."
Presumably this relates to something on your hard drive? Same error for TransContainer.log.
Is this the correct way to load the controls?
What do I need to do to duplicate the lower menu label in your demo? Is there an easy way to copy the attributes?
-
1 Attachment(s)
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Hack
That would be cool, and post your final project in our CodeBank (source code only - no compiled code please :) )
Hi,
I think the control is ready, it would be nice if someone is willing to put it through a "stress test". I've found a few things myself that I had forgotten or behaved unexpected. I also made some improvements and got rid of unneccesary code.
I'm also intrested to know if the control is easy to use and if its properties need more explanation. Like most programmers, I don't like writing manuals, no matter how small. :) But I will if advisable.
TIA
-
Re: Mouseover highlights label text - how?
Cheers Jottum, nicer demo every time!
Can you clarify how I add the controls to a project please?
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Cheers Jottum, nicer demo every time!
Can you clarify how I add the controls to a project please?
Thanks, simple just add MenuLabel.ctl into a project through the Project Menu and you're done . No other files needed. If you want to use the Transcontainer as well, just add that too. If you want the toolbox bitmaps in the IDE, don't forget to put the ctx files in the same folder as the ctl files are.
HTH
-
Re: Mouseover highlights label text - how?
Still get the error messages listed in my post #61 above when I simply add the control.
-
1 Attachment(s)
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Still get the error messages listed in my post #61 above when I simply add the control.
I'm sorry I've missed that post, really don't know why that happes, but I'll attach the original bmp files.
Just delete the ctx files, click away any complaining from vb about the ctx files.
Copy attached bitmaps to a folder first BTW, now select the usercontrol click the View Object button in the Properties window, scroll down to ToolboxBitmap, Select it, click the browse button, browse to the bmp you need and repeat for the other usercontrol.
That should solve it, but it's weird this happens...
HTH
-
Re: Mouseover highlights label text - how?
That seems to work, it shows the icon in the toolbox now.
How do I achieve the following?:
1. Resize the images - is it by resizing the actual file or can it be done in the control?
2. Align the label's text with the middle of the icon. Using your configurator.gif as an example, if I drop the y position of the icon and attempt to reduce the label's height by dragging the handles, the label text drops too low.
3. Make the label transparent as in your bottom demo label
-
Re: Mouseover highlights label text - how?
I can answer 3 now. Set DrawBox and FillBox to false in Menulabel's properties
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
That seems to work, it shows the icon in the toolbox now.
Glad you've got that solved.
Quote:
Originally Posted by Vero44
How do I achieve the following?:
1. Resize the images - is it by resizing the actual file or can it be done in the control?
I think we should make a wish list, ;) I didn't implement image resizing, which is by design. I created the control from the image/application you've linked to earlier in this thread.
If that's what you want I will look in to it tomorrow, shouldn't be to hard hopefully.
Quote:
Originally Posted by Vero44
2. Align the label's text with the middle of the icon. Using your configurator.gif as an example, if I drop the y position of the icon and attempt to reduce the label's height by dragging the handles, the label text drops too low.
That's correct, this is also because I thought you wanted the image as in said link. I think I can make it optional and shrink the control from the top accordingly if you don't want it, as if it appears to be half over the MenuLabel. It's number two on my list.
Quote:
Originally Posted by Vero44
3. Make the label transparent as in your bottom demo label
You've found that one I saw below. I'll get on with the other two requests an post here again when I've got it finished. I think it wont be to hard, but I won't know for sure until I start working on it.
If you have more requests, or run into bugs, (not features :D ) post them here. Maybe I can do it all before the next "release".
HTH
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
That seems to work, it shows the icon in the toolbox now.
How do I achieve the following?:
1. Resize the images - is it by resizing the actual file or can it be done in the control?
2. Align the label's text with the middle of the icon. Using your configurator.gif as an example, if I drop the y position of the icon and attempt to reduce the label's height by dragging the handles, the label text drops too low.
3. Make the label transparent as in your bottom demo label
Hi,
I've made the changes you've requested, hopefully in a way you like.
I've added a few properties because of this - and some others - and one of them I call FloatingImage.
If True, the control looks like it was initially, if False, the image is vertically centered on the control, just like its Caption and there is no transparent part on the top of the control. This means you can only change the image's xOffSet if you don't want a "Floating" image. It was either this or manually vCenter images and I doubt you would want it vertically "misplaced" anyway.
You can now specify the width and Height of your image, the control will either stretch or crop to the new values. The result of this isn't spectacular as you probably can imagine. First of all MenuLabel isn't exactly a PhotoShop clone ;). Secondly because of the size of the images, there isn't much to work with.
I've made a properties demo page on the demo project - see screenshot - that lets you play with the most importent settings, without the need to change anything in code and then look at the result.
I also added a boolean property that enables you to show or not show the push down state.
Because you can configure MenuLabel to be transparent and with only the border visible and if that button is also the selected button, there is no visible mouseover effect. I added a boolean property that will change the border color to the same color as the mouseover text color. This only works if Fillbox = False.
Because I mixed up an X and Y variable, the previous version didn't remember the Y image position (I think it was), that's fixed as well now.
I hope all the coding didn't introduce new bugs, but it looks like we're getting there.
Let me know what you think.
-
Re: Mouseover highlights label text - how?
It probably just has to be like this. :) You've noticed without doubt that the last button on the demo project keeps the selected color?
That's fixed now, but I'll wait for your findings before posting yet another update.
Note for moderators:
Would you like me to remove the older attachments?
-
Re: Mouseover highlights label text - how?
Thanks Jottum, will try to break it over the next few days ;-)
How do I remove the user control and add the latest to my project. Thought I managed to do it before but can't seem to do it now without creating a new project.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Thanks Jottum, will try to break it over the next few days ;-)
:) Probably won't take that long.
Quote:
Originally Posted by Vero44
How do I remove the user control and add the latest to my project. Thought I managed to do it before but can't seem to do it now without creating a new project.
You should be able to copy the new MenuLabel.ctl and overwrite the old one without problems. But you better try that first with a copy of you code. :rolleyes:
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Thanks Jottum, will try to break it over the next few days ;-)
How do I remove the user control and add the latest to my project. Thought I managed to do it before but can't seem to do it now without creating a new project.
Hi,
I'm not going to say the control is finished, but really hope this version comes real close.
I also noticed the yOffSet textbox on the demo project was disabled when it shouldn't and the other way around. :D Fixed that too.
The selection now also clears after you've pressed the test MenuLabel and click on main menulabels. While trying to figure out why that occured, I realised it was impossible to put two groups of Menulabels on the same container and have a selected one in each group.
So, I added yet another property, GroupName that can hold a string that identifies the group a MenuLabel belongs to. In the Demo project I called the group; MainMenu, and the single "Configure Me" MenuLabel; TestLabel. This doesn't do anything in this paricular setup, it's just to uhm... well, demonstrate. :bigyello:
Have fun with it, I really hope it works OK now.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Thanks Jottum, will try to break it over the next few days ;-)
How do I remove the user control and add the latest to my project. Thought I managed to do it before but can't seem to do it now without creating a new project.
Hi,
I hope your silence isn't a bad sign. :)
I don't know if you ran into the small issues that still existed in the previous version I've posted, but I've found a few while cleaning up the code for the final version.
I've made a few improvements, for instance when the MenuLabel has a Floating image, the control only responses to mouse events, when it is over the "box" part. It looked rather silly you could click on a part that appeared to be the form and the Menulabel got pressed. This adds to the illusion the image rests partially on the control. The only thing that still happens now, is that the MenuLabel will get the focus.
I also moved the actual execution of the mouse click to the MouseUp event, this way you can drag the mouse pointer away from the control without a click. I think that makes more sense. I removed the double code that was created when I added the Floating image property.
I've been working on the demo project too, the interface looks much better now and I’ve cleaned up the code to make it more readable, and added more comments. I also added simple help on the Properties Demo page, hopefully that makes a few things clearer.
Unless you come up with anything that needs to be changed or fixed, I will consider this project as finished. I’ll attach the final version and will wait a couple of days before adding it to the codebank.
Enjoy,
-
Re: Mouseover highlights label text - how?
Thanks again Jottum. I'm actually bogged down with work at the moment so haven't got the time to test, rest assured I will when I can and report back here.
This is more than worthy as it stands now to be in the codebank, there was no 'off the shelf' code for a simple but good-looking VB6 menu that I could find anywhere.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Thanks again Jottum. I'm actually bogged down with work at the moment so haven't got the time to test, rest assured I will when I can and report back here.
No worries, take your time. :)
Quote:
Originally Posted by Vero44
This is more than worthy as it stands now to be in the codebank, there was no 'off the shelf' code for a simple but good-looking VB6 menu that I could find anywhere.
I will just wait for your findings, it can wait to be added to the codebank.
Take care,
-
Re: Mouseover highlights label text - how?
Quickly looked at the latest demo, a quick query:
For my purposes, just loading all 3 images and checking 'Transparent' and 'Enabled' achieves everything except highlighting the text on mouseover. Is this just the demo that requires changing or does the new code achieve this? As I said, will test it ASAP, just thought I'd ask (it is, after all, the title of this thread :bigyello: :bigyello: ).
-
Re: Mouseover highlights label text - how?
OK, quick test in my lunchbreak. Looks good but 2 errors I can see.
1. The error we talked about before (the control's bitmap not loading which requires a manual load).
2. Create a label that uses your 48x48 configurator.gif as an icon, normal, down and hover bitmaps set. Set Drawbox, Fillbox, Floating Image to false. Set the LabelImageXwidth and LabelImageXheight to 24 each (my ideal icon size). Now resize the label on the form. The icon gets cut by the label's 'frame'. Using LabelImageY I can set the icon to look better on the form but at runtime it is moved to the original 'chopped off' position and, strangely, when ending the program, the previous LabelImageY is shown.
Any ideas?
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Quickly looked at the latest demo, a quick query:
For my purposes, just loading all 3 images and checking 'Transparent' and 'Enabled' achieves everything except highlighting the text on mouseover. Is this just the demo that requires changing or does the new code achieve this? As I said, will test it ASAP, just thought I'd ask (it is, after all, the title of this thread :bigyello: :bigyello: ).
When you place a new instance of a MenuLabel on a form, it has all the above settings by default. Perhaps what is misleading in the demo, the "Configure Me" button is the only one in its "group". If you click it, it becomes the selected one and obvously stays that way. If you now hover the mouse over the MenuLabel, you don't see the caption highlighted, because it is already that color.
I think that is what you mean? I'll change that in the demo, so you can still see the caption getting changed when you hover your mouse after it gets selected.
Again, take your time, I'm in no hurry. :)
-
Re: Mouseover highlights label text - how?
Re: 2 above
I tried resizing the gif first to 24x24 and it seems to work fine.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
OK, quick test in my lunchbreak. Looks good but 2 errors I can see.
1. The error we talked about before (the control's bitmap not loading which requires a manual load).
I really don't know why that happens, but I have the same problem occasionally when loading someone else's project. There's no path reference to the toolbox bitmap that I know of, so I have no idea how to solve that other then manual reloading of the original bmp, which you did. :confused:
Quote:
Originally Posted by Vero44
2. Create a label that uses your 48x48 configurator.gif as an icon, normal, down and hover bitmaps set. Set Drawbox, Fillbox, Floating Image to false. Set the LabelImageXwidth and LabelImageXheight to 24 each (my ideal icon size). Now resize the label on the form. The icon gets cut by the label's 'frame'. Using LabelImageY I can set the icon to look better on the form but at runtime it is moved to the original 'chopped off' position and, strangely, when ending the program, the previous LabelImageY is shown.
Any ideas?
Yes I do, I'm forgetting to asign the proper values to a couple of variables, and I know where in the code that is as well. I'll fix it, will try to post an update today, if you find more, let me know.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
[...]
Any ideas?
Have another look if you will, the problems you described in #2 should be gone. Image size settings are supposed to stick. If the original image is 48 x 48 and you set it to 24 x 24, next time you fire up that's the size used. These setting will only be lost when you set the normal label image to nothing.
It all seems to work now, but I'm the worst possible beta tester for my own code, so I'll wait for your findings. ;)
To get a better idea what the "Configure Me" Menulabel on the demo will look like with all the different settings, I added the vbVision Grabhandles (Check Resizable). This way you can resize the MenuLabel on the fly.
In those cases where Drawbox and Fillbox are both False, a dotted rectangle is drawn onto the control to assist while you're resizing it. The properties for this functionality are added to the control for this reason only, are False by default and do not stick.
Have fun, :)
-
Re: Mouseover highlights label text - how?
'....final1.zip' :D Sounds like one of my program names!
I'll update the control to test but the last version gave me exactly what I wanted. (Thanks again!)
Only 1 problem I saw:
Using an array of 8 labels, when one menulabel is clicked that brings up a msgbox (in my case correctly because a file was not found), the label highlights correctly. I click OK on the msgbox, I select another menulabel and the previous menulabel is still highlighted. Hover the mouse over the incorrect one and it goes back to the correct colour.
Otherwise the program ran happily in both Windows XP and in PE mode with no requirement for external files.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
'....final1.zip' :D Sounds like one of my program names!
:D
Quote:
Originally Posted by Vero44
I'll update the control to test but the last version gave me exactly what I wanted. (Thanks again!)
My pleasure, I enjoyed creating it.
Quote:
Originally Posted by Vero44
Only 1 problem I saw:
Using an array of 8 labels, when one menulabel is clicked that brings up a msgbox (in my case correctly because a file was not found), the label highlights correctly. I click OK on the msgbox, I select another menulabel and the previous menulabel is still highlighted. Hover the mouse over the incorrect one and it goes back to the correct colour.
You will have the same problem when you use a MenuLabel to display a Popup menu.
This occurs because either a Msgbox or a Popup menu steal the mouse capture before the MenuLabel can update its state, I think.
I will look into it, there are a few options;
- Use a Trackmouse class, which would add at least one file to your project
- Use Subclassing, which you don't want I think. :)
Perhaps I can figure out another way that won't need any of the above.
I will let you know if and what I can do about it.
Quote:
Originally Posted by Vero44
Otherwise the program ran happily in both Windows XP and in PE mode with no requirement for external files.
That's nice to here, it would be nice if there aren't any hidden issues left.
-
2 Attachment(s)
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
Using an array of 8 labels, when one menulabel is clicked that brings up a msgbox (in my case correctly because a file was not found), the label highlights correctly. I click OK on the msgbox, I select another menulabel and the previous menulabel is still highlighted. Hover the mouse over the incorrect one and it goes back to the correct colour.
Perhaps easier than I thought, that is, if it works for you too. I'll attach just the updated UC.
Edit:
Changed attachment to updated demo project. I've removed all the testversions from this thread.
-
Re: Mouseover highlights label text - how?
That works like a charm Jottum.
I'll try to test on W95 to Vista over the next few weeks. Need to setup a few test machines first. The program I'm developing I will use daily out in the field repairing all varieties of PCs so it will get a good trial.
I just need to create some nice icons for the labels and it'll be ready for use as a final version. Final29 that is........ :D
I really like this menu's feel and I'm sure you'll get lots of downloads from the codebank.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
That works like a charm Jottum.
Cool! Sometimes the simplest solutions do. ;)
Quote:
Originally Posted by Vero44
I'll try to test on W95 to Vista over the next few weeks. Need to setup a few test machines first. The program I'm developing I will use daily out in the field repairing all varieties of PCs so it will get a good trial.
You can skip XP and Vista, I'm developing on a Vista box and test for compatibility on an XP box. Both work without any problems. Might save you some work. I still have a Pentium I with W95 here, but haven't used it for ages. If you want, I can see if it still runs and run the demo on it.
Quote:
Originally Posted by Vero44
I just need to create some nice icons for the labels and it'll be ready for use as a final version. Final29 that is........ :D
Which can be quite a challenge, there's millions of Icons out there, if you know what you're looking for... Not sure where I've found them, but quite a while back I downloaded almost 6000 true color high quality 128 x 128 png's. I usually can use one of them and shrink it with PSP.
Quote:
Originally Posted by Vero44
I really like this menu's feel and I'm sure you'll get lots of downloads from the codebank.
Glad you like it, like I said it was my pleasure.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Jottum
I still have a Pentium I with W95 here, but haven't used it for ages. If you want, I can see if it still runs and run the demo on it.
That would be good thanks. I'd like to test it on a W95 box with a basic clean install too though, no VB runtimes as my program is a single exe. Often other programs install these runtimes when required.
Quote:
Originally Posted by Jottum
Which can be quite a challenge, there's millions of Icons out there, if you know what you're looking for... Not sure where I've found them, but quite a while back I downloaded almost 6000 true color high quality 128 x 128 png's. I usually can use one of them and shrink it with PSP.
I'll try to develop my own as I know there are lots of copyrighted icons out there. Luckily, this doesn't stop me from using and testing the program for now.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Vero44
That would be good thanks. I'd like to test it on a W95 box with a basic clean install too though, no VB runtimes as my program is a single exe. Often other programs install these runtimes when required.
Without the proper VB runtime files you can not run a VB application, no matter what Windows version. It makes no diffrence if it is a single exe or not. :)
I'll try to fire up the W95 box today, and let you know the results.
Quote:
Originally Posted by Vero44
I'll try to develop my own as I know there are lots of copyrighted icons out there. Luckily, this doesn't stop me from using and testing the program for now.
That's true, but that still leave plenty without that restriction. Making your own, is more original anyway.
-
Re: Mouseover highlights label text - how?
Quote:
Originally Posted by Jottum
I'll try to fire up the W95 box today, and let you know the results..
The W95 box doesn't run, I'm not sure when I will have the time to find out why that is, but will try to do so this weekend.