|
-
Nov 16th, 2014, 07:20 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] VB6: Problem Understanding TabStrip
I know this is a rookie question, but I can’t find a clear answer by searching the forum or the Internet.
I’m trying to cannibalize some code from a project written by another programmer. This program has a TabStrip object placed on the form (personally, I prefer SSTab, but it is what it is). I would like to see the controls and underlying code that are on each tab. This is easy for the first page, because it’s on top. But when I click on each successive tab, nothing happens.
I see the controls at runtime when I click each tab. But in design mode I’m stuck. I see where this guy makes the hidden tabs visible and invisible when each tab is clicked, but I don’t see the form controls themselves.
This TabStrip thing is weird. How do I view the controls and the code behind them on the other tabs? Or am I thinking about this all wrong?
-
Nov 16th, 2014, 07:45 AM
#2
Re: VB6: Problem Understanding TabStrip
Or am I thinking about this all wrong?
No, the TabStrip can be difficult until you have worked with it for a while.
What makes it difficult is that it is NOT a container, as is the SSTab.
Most coders use a container, such as a frame or picturebox to hold the
individual controls and make that container visible or not visible in response
to TabStrip tab selection.
You can get an idea of what the original coder was doing by right clicking
controls & selecting 'bring to front' or 'send to back'. This is also
available under Format|Order.
-
Nov 16th, 2014, 08:08 AM
#3
Thread Starter
Hyperactive Member
Re: VB6: Problem Understanding TabStrip
 Originally Posted by VBClassicRocks
You can get an idea of what the original coder was doing by right clicking controls & selecting 'bring to front' or 'send to back'. This is also available under Format|Order.
Thanks for responding. When I right click on the frame that holds the controls for the first tab, 'bring to front' and 'send to back' are grayed out. Same thing when I try Format|Order. Any other suggestions?
-
Nov 16th, 2014, 12:28 PM
#4
Re: VB6: Problem Understanding TabStrip
When I use a TabStrip I create the "panel" for each tab as a UserControl.
This simplifies the heck out of design-time layout, and also keeps the "code behind" all "behind" its respective panel. This means far less of a spaghetti-mess in the hosting Form as well.
-
Nov 16th, 2014, 02:03 PM
#5
Re: VB6: Problem Understanding TabStrip
vb6coder14, I second your preference for the SSTab. I have used the SSTab for many years and absolutely love it. The SSTab has a touch of a bug regarding the focus, but I've long since written a little Class object that perfectly fixes that. If you would like to see it, just ask and I'll post it. In fact, I'll post it now over in the codebank.
If it's not too much work, I'd even consider swapping out the TabStrip for the SSTab in whatever application you're working with.
Good Luck,
Elroy
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.
-
Nov 16th, 2014, 02:08 PM
#6
Re: VB6: Problem Understanding TabStrip
 Originally Posted by vb6coder14
Thanks for responding. When I right click on the frame that holds the controls for the first tab, 'bring to front' and 'send to back' are grayed out. Same thing when I try Format|Order. Any other suggestions?
Ensure the "lock controls" menu item is not selected: Menu Format|Lock Controls
-
Nov 16th, 2014, 06:17 PM
#7
Thread Starter
Hyperactive Member
Re: VB6: Problem Understanding TabStrip
 Originally Posted by VBClassicRocks
No, the TabStrip can be difficult until you have worked with it for a while.
What makes it difficult is that it is NOT a container, as is the SSTab.
Most coders use a container, such as a frame or picturebox to hold the
individual controls and make that container visible or not visible in response
to TabStrip tab selection.
You can get an idea of what the original coder was doing by right clicking
controls & selecting 'bring to front' or 'send to back'. This is also
available under Format|Order.
Excellent explanation. Those controls are hiding behind frames. Once I read your post, I went back into the project and started deleting layer upon layer of frames until I came to the one I was looking for. What a strange control. Thank you for your assistance.
-
Nov 16th, 2014, 06:22 PM
#8
Thread Starter
Hyperactive Member
Re: VB6: Problem Understanding TabStrip
Elroy;
I'm looking forward to seeing your solution to the focus bug. And believe me, I've already abandoned the TabStrip and replaced it with SSTab.
-
Nov 16th, 2014, 06:33 PM
#9
Re: VB6: Problem Understanding TabStrip
Hey vb6coder14,
It's already posted in the codebank. Just throw it in a class, create a new instance of it in your Form_Load event, and then call the SetTabControl also in Form_Load, and the SetTabStopsAccordingly in your Form_Activate, and voila, all fixed.
Don't forget to declare your class at module level. And, if you use the "New" keyword at module level, you can go straight to calling the SetTabControl in the Form_Load event.
I'm assuming you know how the class instantiation stuff works, but can explain that a bit more if you want. Basically, just somewhere, there needs to be a "New" keyword to get the object created from the class.
Enjoy it,
Elroy
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.
-
Nov 16th, 2014, 06:42 PM
#10
Re: VB6: Problem Understanding TabStrip
Hey, if you already grabbed it, ignore that line about BogusTextBox. That was a hangover from when I was trying to make the Forms2.0 stuff work in conjunction with the SSTab control. I've LONG since abandoned any attempt to make use of the Forms2.0 stuff, and have written my own custom controls that are bulletproof and do more than they do (and aren't full of bugs like those things are). I actually got them working but distribution problems made me abandon them. They have a MAJOR bug in them with respect to the Carat. Not exactly the topic here, but you have to issue a DestroyCarat when they lose focus or things are a mess.
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.
-
Nov 16th, 2014, 07:16 PM
#11
Thread Starter
Hyperactive Member
Re: VB6: Problem Understanding TabStrip
 Originally Posted by Elroy
It's already posted in the codebank.
Thanks! I'll grab it now.
 Originally Posted by Elroy
I'm assuming you know how the class instantiation stuff works, but can explain that a bit more if you want.
Please remember I'm a rookie. I haven't learned classes just yet, so any further explanation would be welcome.
-
Nov 16th, 2014, 07:42 PM
#12
Re: VB6: Problem Understanding TabStrip
Ahhh, ok, I'll just throw together a small project that sets it all up (see attached).
TabFixExample.zip
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.
-
Nov 16th, 2014, 08:03 PM
#13
Re: VB6: Problem Understanding TabStrip
Class modules are a bit tricky at first, but once you get the hang of them, they're pretty cool. I think of them as code that's just sitting in my EXE file, but not loaded into memory until I need it. I've been rather severely "dressed down" by Schmidt for not using the correct language when speaking of classes, so I will. When you create an "Object" from a "Class", it's called instantiation (or, to create an "instance" of). It's just getting the code in memory from the EXE and also creating space for all the variables internal to the class. You can declare a variable for holding the object created from your class, but the class isn't instantiated until the "New" keyword is used somewhere (either in the "Dim", or possibly with a "Set" statement).
And when you're done with it, you just set it to nothing:
Code:
Set MyClassObject = Nothing
Or, if it goes out of scope, that'll happen automatically.
I think of the CLASS module as a template (or some say blueprint) whereas the instantiation ("New" keyword) of it creates the actual Object to be used.
You can think of BAS modules a bit the same way, in that the code sits in the EXE program until it is executed (upon which it is copied into memory), but ALL of your BAS module code is copied into memory upon execution, and you only have the possibility of one copy of it, whereas CLASS modules are only called in when you specify, and you can instantiate as many copies as you like.
Just a brief introduction.
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.
-
Nov 16th, 2014, 10:38 PM
#14
Re: VB6: Problem Understanding TabStrip
 Originally Posted by Elroy
I've been rather severely "dressed down" by Schmidt for not using the correct language when speaking of classes, so I will. When you create an "Object" from a "Class", it's called instantiation (or, to create an "instance" of). It's just getting the code in memory from the EXE ...
No, that's not what happens when you instantiate an Object from a Class.
 Originally Posted by Elroy
...and also creating space for all the variables internal to the class.
Not "also" - *only* for these variables will memory be allocated when you create an Instance.
 Originally Posted by Elroy
You can think of BAS modules a bit the same way, in that the code sits in the EXE program until it is executed (upon which it is copied into memory), but ALL of your BAS module code is copied into memory upon execution, and you only have the possibility of one copy of it, ...
There's absolutely no difference in terms of loading-behaviour between the static parts
(the Procedures) of a VB-Class and a VB-Module.
Please read about light-weight COM-Classes - then implement one of them in a *.bas-Module,
to learn and understand better what really happens.
Olaf
-
Nov 16th, 2014, 11:22 PM
#15
Re: VB6: Problem Understanding TabStrip
Oh geez, I could have guessed. vb6coder14, just so you know, I don't really respond to Olaf's posts. He may be a smart guy (and even that's a matter of opinion as far as I'm concerned), but he's got nothing to say that I'm interested in.
I wish you all the best though.
Take care vb6coder14,
Elroy
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.
-
Nov 17th, 2014, 01:06 AM
#16
Re: VB6: Problem Understanding TabStrip
 Originally Posted by Elroy
I don't really respond to Olaf's posts. He may be a smart guy (and even that's a matter of opinion as far as I'm concerned), but he's got nothing to say that I'm interested in.
This kind of ignorance is perhaps the reason, why others have to do such a lot
of cleanup after your postings.
Olaf
-
Nov 17th, 2014, 07:29 AM
#17
Re: VB6: Problem Understanding TabStrip
Thanks for responding. When I right click on the frame that holds the controls for the first tab, 'bring to front' and 'send to back' are grayed out. Same thing when I try Format|Order. Any other suggestions?
Another way: Select a container (frame, picturebox) from the dropdown list of controls (Properties). It may or
may not become visible. Then select View|Object. Again it may or may not be visible, but you can use Ctrl-Arrows
to move the control into view.
-
Nov 17th, 2014, 04:13 PM
#18
Thread Starter
Hyperactive Member
Re: VB6: Problem Understanding TabStrip
 Originally Posted by Elroy
I wish you all the best though.
Take care vb6coder14,
No worries Elroy. You're still tops in my book! Your help and advice has been invaluable. I plan to give you more reputation as soon as the system allows me to do so.
-
Nov 17th, 2014, 04:23 PM
#19
Re: VB6: Problem Understanding TabStrip
Hey, absolutely no worries, vb6coder14.
How's the saying go? “Being upset with someone is just giving them free rent in your head.” No free rent for Olaf. It’s not worth my time.
*smiles and laughs*
You take care,
Elroy
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.
-
Nov 17th, 2014, 09:46 PM
#20
Thread Starter
Hyperactive Member
Re: VB6: Problem Understanding TabStrip
 Originally Posted by Elroy
When you create an "Object" from a "Class", it's called instantiation (or, to create an "instance" of). It's just getting the code in memory from the EXE and also creating space for all the variables internal to the class. You can declare a variable for holding the object created from your class, but the class isn't instantiated until the "New" keyword is used somewhere (either in the "Dim", or possibly with a "Set" statement).
And when you're done with it, you just set it to nothing:
Code:
Set MyClassObject = Nothing
Or, if it goes out of scope, that'll happen automatically.
I think of the CLASS module as a template (or some say blueprint) whereas the instantiation ("New" keyword) of it creates the actual Object to be used.
You can think of BAS modules a bit the same way, in that the code sits in the EXE program until it is executed (upon which it is copied into memory), but ALL of your BAS module code is copied into memory upon execution, and you only have the possibility of one copy of it, whereas CLASS modules are only called in when you specify, and you can instantiate as many copies as you like.
Just a brief introduction.
There's a great deal of truth in the old saying "You can't teach an old dog new tricks!" I programmed batch and online COBOL for over 15 years (1980 - 1995) and when I try to wrap my head around object oriented programming concepts it makes my brain want to explode. That's why I decided to learn VB6 instead of Java. VB6 is so close to COBOL that I feel right at home. It's just a matter of learning the syntax.
This project is so big I have no doubt that I'll be highly proficient with VB6 when I'm done. After I finish I plan to take another stab at OOP. Maybe the next time around it'll all click. Yeah, right.
Nevertheless, I appreciate your explanation. I'll study it a bit more when time permits. Meanwhile, I've accomplished my major objectives with ListView except for a minor problem that I've struggled with all day today. But I think I'll post that question in another thread. I'm marking this thread resolved now. Thanks again for all of your help Elroy.
-
Nov 18th, 2014, 09:35 AM
#21
Re: [RESOLVED] VB6: Problem Understanding TabStrip
Hey vb6coder14,
The use of class modules is certainly not mandatory AT ALL to get a great deal of fantastic work done. And hey, you sound like you just might be almost as old as me. 
To use an old term, I often think of class modules as "overlays" that we just have a great deal of control over. 
Best of luck with your project,
Elroy
EDIT: I was more on the FORTRAN side back in those days though. Never messed with any COBOL.
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.
-
Nov 18th, 2014, 12:51 PM
#22
Thread Starter
Hyperactive Member
Re: [RESOLVED] VB6: Problem Understanding TabStrip
FORTRAN? OMG!!! I didn't know there were still people alive who even heard of Fortran (at least under the age of 50). I played with it a little bit, but COBOL was my first love.
-
Nov 18th, 2014, 02:35 PM
#23
Re: [RESOLVED] VB6: Problem Understanding TabStrip
*laughs*
Well, since we're on the topic of old stuff, here's a fun link for you. 
http://www.99-bottles-of-beer.net/la...080)-2157.html
EDIT: My claim to fame. LMAO.
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.
-
Nov 18th, 2014, 02:43 PM
#24
Re: [RESOLVED] VB6: Problem Understanding TabStrip
Ohhh, and just in case you want it on the fancy new Z80 processor built by a bunch of disgruntled Intel engineers who went off and formed Zilog, here you go. 
http://www.99-bottles-of-beer.net/la...z80)-2158.html
Boy, I bet those engineers are regretting that decision. I doubt anyone here has ever heard of Zilog. That little Z80 was a nice chip though.
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.
-
Nov 18th, 2014, 02:55 PM
#25
Thread Starter
Hyperactive Member
Re: [RESOLVED] VB6: Problem Understanding TabStrip
*Totally laughing out loud*
Do you think anyone except us old timers even know what an 8080 or Z80 chip was? My first PC was a Zenith Z-100 built on an 8088 chip housing a 10mb hard drive the size of a brick, dual 360k 5 1/4" floppy disk drives, and 256k of memory. This was high tech stuff in the days of the Sinclair, the PCjr with its chicklet keyboard and the TRS "Trash" 80. How's that for nostalgia?
-
Nov 18th, 2014, 03:07 PM
#26
-
Nov 18th, 2014, 03:12 PM
#27
Thread Starter
Hyperactive Member
Re: [RESOLVED] VB6: Problem Understanding TabStrip
You take care too Elroy!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|