Results 1 to 27 of 27

Thread: [RESOLVED] VB6: Problem Understanding TabStrip

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Resolved [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?

  2. #2
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by VBClassicRocks View Post
    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?

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    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.

  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by vb6coder14 View Post
    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
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by VBClassicRocks View Post
    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.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    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.

  9. #9
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  10. #10
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by Elroy View Post
    It's already posted in the codebank.
    Thanks! I'll grab it now.

    Quote Originally Posted by Elroy View Post
    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.

  12. #12
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  13. #13
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  14. #14
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by Elroy View Post
    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.

    Quote Originally Posted by Elroy View Post
    ...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.

    Quote Originally Posted by Elroy View Post
    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

  15. #15
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  16. #16
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by Elroy View Post
    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

  17. #17
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    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.

  18. #18

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by Elroy View Post
    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.

  19. #19
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  20. #20

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: VB6: Problem Understanding TabStrip

    Quote Originally Posted by Elroy View Post
    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.

  21. #21
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  22. #22

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    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.

  23. #23
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  24. #24
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    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.

  25. #25

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    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?

  26. #26
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    Re: [RESOLVED] VB6: Problem Understanding TabStrip

    Ohhhh, pffff. One of my first programming (actually more hardware engineering) endeavors was building a hardware interface between a TRS-80 Model I and a Vector Graphics S100 bus system. I had the TRS-80 and a friend had the S100 bus system. I had 16k of memory, and he only had 4k (on a HUGE S100 bus board FILLED with chips).

    He didn't really have an OS beyond almost flipping switches to program things in one byte at a time. But we successfully ported the little BASIC OS (from Microsoft with the ok prompt) out of the TRS-80 onto the Vector Graphics system and "sort of" got it going.

    Fun times. His wife and my wife were in the hospital at the same time having our first-born's. That same son just made me a grandpa about 2 months ago. LOL.

    Hey vb6coder, you take care.
    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.

  27. #27

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    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
  •  



Click Here to Expand Forum to Full Width