Here, this is my very latest version of the thing. I forget if this is what I last posted or not, but here it is:
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Ahhh!!! Wonderful!! I missed that, but my eyes are really burning right now. I was looking for size and my eyes never settled on LEDSIZE - lol.
I also need to read the link, way back when, you left for designing user controls. I have loaded your control in VB6 in design mode and do not see how you are making the round LED (which is PERFECT by the way). The form associated with it just looks like a large form with a time control on it and no drawing of the LED. I started to look at the code behind the user control and my head started throbbing. I will look at it further tomorrow.
Hopefully, I can link a bunch of them together as a control array and assign each one its own index value.
Ahhh, yeah, I left you messages about how to get started with User-Controls. Both Eduardo and I sort of got carried away with this thing.
The latest version is using a Windows graphing library called GDI+, which does a very nice job of drawing things. However, it's fairly advanced to use. In this latest version, that's what's being used to draw both the LED dot and the border around it. The fact that it's done with GDI+ is why it looks so nice.
If you want to start learning about User-Control, my post #18 is a much better starting place. That version of the control uses standard VB6 drawing objects and a label control on the custom User-Control ... and it's far less code in it. I don't think it even has any API calls in it.
It works fine, it's just not nearly as "pretty" as the latest version.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
I doubt that "Cumulative Update for SP6" is SP6 itself.
Worse yet, it sounds like the thing they also called "Security Rollup" that actually broke a lot of controls, inserting off-by-one errors in many places that could cause program crashes and data corruption. The security issues it was meant to address only mattered for OCXs for deployment as part of IE web pages anyway.
I can't even find a Microsoft download for SP6 any more. The newest one that I have here is Vs6sp6d.exe and that may have been the last one.
I stumbled with acmsetup added the files and folders as need and got VB6 Installed again on this bench computer.
When I try to install the SP6 service pack, I am getting this:
That message indicates that what you were trying to install at that point was not VB 6.0 SP6, but instead, a cumulative update for devices already running VB 6.0 SP6. I see you posted below that you found the actual SP6 and got that installed, but I wanted to mention this for your own sake and for anyone else down the road that might be reading this.
I just looked and I forgot to put a "Caption" property in that post #18 version (to change the label's caption), but it might be a good exercise for you to figure out how to do that.
Basically, a Public Get and Public Let Property named Caption, set the Label's caption with the incoming Public Let's argument. And then also read & write them to the control's property bag.
I'm willing to just continue on with this thread if you'd like to try and understand user-controls more. Personally, I think they're fun.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
A little anomaly I found, maybe you can splain. Here I added two control, each with a different index. Looks fantastice: Attachment 185890
I move the control and it goes blank unless I resize it: Attachment 185891
Dave, these forums have a bug regarding attaching pictures. You have to go to "Go Advanced" (before posting) for it to always work correctly. And I can't see your pictures.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Also, it's always best to save your pictures as PNG files if you can do that. JPGs also work, but PNGs are better.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Upon runtime, it all works fine ... so there's that.
When you move the control, it's just not getting a refresh during design-time. If you close-and-reopen the form, that also fixes it.
I'll look at it though. Without doing subclassing, I'm not positive I can detect those moves though. Also, I disabled the blinking during design-time. If I enabled that, that'd also fix it.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Dave, these forums have a bug regarding attaching pictures. You have to go to "Go Advanced" (before posting) for it to always work correctly. And I can't see your pictures.
If I change any parameter of the control, it comes back. If I move the control, it looks like it does in the second picture.
What I can do is leave the background color different than the form. That way, I can always see where the LED is at. Then during the load event, change the background color to match the form background.
I do not think it will take me that long to adapt the programs that use it to your user control. It is still funny that in the "home" machine, the old .ocx control works perfect. Well, I can not waste any more energy in trying to figure that out. It is what it is and your control is most probably a lot more powerful.
BTW, good night, I must head upstairs to the TV and what not.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
What I can do is leave the background color different than the form. That way, I can always see where the LED is at.
I think that's a good idea.
Originally Posted by daveyk021
I do not think it will take me that long to adapt the programs that use it to your user control.
Good to hear.
Originally Posted by daveyk021
It is still funny that in the "home" machine, the old .ocx control works perfect.
Personally, I think it's better to have all the source code to everything, and have it all in one project (if possible).
Originally Posted by daveyk021
BTW, good night, I must head upstairs to the TV and what not.
Have a nice evening.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
I will put an image of my finished form with your control when I have it updated.
The hard of an array in Frame container is that I can not copy Paste as VB6 will not link them then even if I rename the control and set the correct index, plus it disappears in the frame. So, I must add the control and then do all the color and size changes, index change, and everything else. I wish I could just paste, change the index and caption.
Anyway, working on it a bit now, then I must get to doing some real paying work in the shop.
Changing any of those would change the initial values of things when placing a new control on your form.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
And the Font is a bit different. If you wish to change the default caption font, just open the UC's designer form (closing other forms first), and then change the font of the UC's designer form. That's where the font is stored for this UC (to be used for the caption).
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
You may ask why I keep saying to "close other forms first". If you simultaneously have a form open that has a custom UC on it, and also have that custom UC open for editing, the IDE sometimes gets confused and changes all those custom UCs on the other form to PictureBoxes. If your other forms are just sitting in the Project Window (unopened), this never happens.
And this sort of makes sense, considering all the things the Intellisense is trying to do (show you all the properties and methods of everything).
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
I do see that there is not an "Enable" parameter. That is not a big deal, but I typically, in the load event, or by default, have the LED not enabled, until after the program has made the serial connection to the instrument under test.
So the form comes up, you can see all the controls, but they are all disabled except for the the Serial Communication Port pull-down. Once a connection to the instrument under test, has been established, all controls are enabled. Typically that is done to any control with a given TAG.
I'm going to disallow blinking if it's disabled, and I'm also going to add other new properties: Disabled-LED-Color & Disabled-Caption-Color. I'll just use light gray for those defaults.
Also, if you tell me what you'd like for the size defaults, I'll change those too.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
I'm going to disallow blinking if it's disabled, and I'm also going to add other new properties: Disabled-LED-Color & Disabled-Caption-Color. I'll just use light gray for those defaults.
Also, if you tell me what you'd like for the size defaults, I'll change those too.
Too cool; thank you. Light grey disabled is grey. Defaults? I seen to like a boarder size of 2, size 200. I'm not sure of color. I have these at yellow, but, I will probably change that to clear, then during a test, blink yellow, after test, if the test passes, it will be solid green or solid red if the test fails.
Dude, you really came up with something great here. You should sell this! I need to compensate you. In my shop it is just me and these control and test programs I write make my life easier. I plan to keep the shop going for at least two and a half years yet, before going full hobby. Life gets shorter and shorter, I probably should quit when I'm 64.5. Right now, it is still fun! I'm not sure if they make me more efficient, or give me more time to watch YouTube when I should be working - lol.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Changed "BorderWidth" property's new default value to 2.
Changed "LedSize" property's new default to 200.
Changed "LedColor" property's new default to vbYellow.
Ok, you also mentioned the BackColor property, and maybe having a transparent option. That's not as totally easy as it might seem. The reason is that I don't necessarily know the container's back-color until runtime. So, here's what I can do. I can give you a Transparent property, but it will only work during runtime. Would you like that?
And, a related question. When the LED is blinking, but off, should it also use that container's back-color? Or should it stick with it's own LedOffColor? Or, should I have another "LedBackStyle" property (opaque/transparent) that determines that?
Work attached.
p.s. No payment needed. I'm a 70yo retired guy who just enjoys trying to keep my mind sharp. I don't mind giving you my email though, but I'd rather just stick with this thread regarding this LED work.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Okay, it hashes out once I go to your control to look at all the options
I'm not sure what it take to un-hash them.
Ok, that's why I keep saying to close your regular form before messing with the UC's code (or designer form). When it does that, just close that form, close the UC stuff, and then re-open the form ... and you're usually ok.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
If ControlBackStyle is Opaque it used the BackColor property. If ControlBackStyle is translucent, it uses the UC container's BackColor property.
The LedOffStyle is a bit trickier. Here's the Select Case statement for what it does:
Code:
Select Case True
Case mlLedOffStyle = styleOpaque: iFillColor = mlLedOffColor
Case mlControlBackStyle = styleOpaque: iFillColor = mlBackColor
Case Else: iFillColor = Ambient.BackColor
End Select
That only executes when the LED is off (but not disabled), such as blinking off, or just turned off. Otherwise it's filled with the LedColor value.
Work attached.
Eduardo: I just vertically center both the LED and the caption, so I don't really worry about clipping. And also, the caption wraps, so horizontal clipping doesn't really make sense. Regarding vertical clipping, I suppose I could monitor changes to both the LED and the caption's font, and resize accordingly, but the caption wrapping would make even that difficult. That caption just complicates auto-sizing, and that's why I just didn't bother with it. Just let him work it our during designing.
Last edited by Elroy; Sep 26th, 2022 at 12:39 PM.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Ahhh, yeah, that's another level. I believe you're using "regions" to get that done. Again, with the caption, that gets rather complex. I'll let Davey ask for that before I throw myself into that one.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Ahhh, yeah, that's another level. I believe you're using "regions" to get that done. Again, with the caption, that gets rather complex. I'll let Davey ask for that before I throw myself into that one.
No, the whole control is the region, like it is now.
Last edited by Eduardo-; Sep 26th, 2022 at 01:10 PM.
No, the whole control is the region, like it is now.
Well, that was easy enough. I saw the commented out lines, and the new lines.
Dave, not sure you'll use it, but Eduardo has given you the ability for a more true transparency, in the case where your container has a picture in its background.
He used my latest code and patched it up, so it's got all of my latest changes. I've taken his work and I'm calling it the "latest".
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
If both ControlBackStyle=transparent, and LedBackStyle=transparent, you now get the picture in the center of the LED, as it should be.
The new Select Case for that (when the LED light isn't shining):
Code:
Select Case True
Case mlLedOffStyle = styleOpaque: iFillColor = mlLedOffColor
Case mlControlBackStyle = styleOpaque: iFillColor = mlBackColor
Case Else: iFilled = False
End Select
Work attached (including Eduardo's mod):
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Just as an FYI, I know you're trying to get some design work done.
For ALL of these recent changes, to implement them, all you have to do is to open the UC's code window, delete all the code, and then paste the code from the latest version. (Again, closing all your other forms when you do this.)
But, done this way, all the changes will just automatically appear on all your design work with this UC.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Yes, but there was an issue in the first version that I posted, I fixed that soon but you had already downloaded.
The issue is that the control is not painted at runtime until it blinks.
Yes, but there was an issue in the first version that I posted, I fixed that soon but you had already downloaded.
The issue is that the control is not painted at runtime until it blinks.
Here is your latest version but with the fix.
Ahhh, perfect. You just moved it up to where the property is changed.
Davey, you keeping up?
Also, I've got to run some errands. I'll almost certainly check in later.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.