dcsimg
Results 1 to 6 of 6

Thread: [VB6] - Usercontrol PropertySheet Enumeration Enhancement

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,392

    Thumbs up [VB6] - Usercontrol PropertySheet Enumeration Enhancement

    I was looking at a post on vbAccelerator on using a DLL and TLBs to customize the dropdown listing shown on IDE's property sheet for usercontrol properties. The project showed how a typical dropdown might look like the following and can be modified at will
    Code:
    Default Behavior        Modified Behavior
    0 - vbLeftJustified      0 - Left Aligned
    1 - vbRightJustified     1 - Right Aligned
    2 - vbCenter             2 - Centered
    I really liked the idea and thought about a different way of accomplishing the same thing without any ActiveX DLL or TLBs. The attached is my version of vbAccelerator's project.

    Note that the methods used allow on-demand, dynamic, "enumerations" that can even be strings vs numerical enumerations. These enumerations are not true enumerations but rather an array of strings that act like enumerations within the property sheet, providing a dropdown list to select from.

    For example. Let's say your user control needs to show a listing of available textboxes on the form. In the past, we would have to offer a property page that basically added all the textbox names to a listbox so the user can select one from it. Now, we can provide that list in a dropdown box that will be displayed on the property sheet and no need for a property page just for that purpose.

    Anyway, I thought vbAccelerator project was interesting enough to try and replicate it a diffferent way. This is the different way.
    Warning. Pretty advanced stuff for such little gain, IMO, but it does present a more "professional" and personal touch to how enumerations are offered to users in design time.
    Name:  screenshot.JPG
Views: 1077
Size:  20.6 KB
    Attached Files Attached Files
    Last edited by LaVolpe; Dec 18th, 2008 at 10:19 AM.
    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}

  2. #2

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,392

    Re: [VB6] - Usercontrol PropertySheet Enumeration Enhancement

    Updated. The zip in the first post contains the updates.

    Added capability of displaying dialog boxes or modal forms vs a property page.

    Example, let's say you wanted the ability to select a file from the property sheet just like the richt text control does. Now you can. Your property will get an ellipse button and then the usercontrol will be notified to display the appropriate dialog box.
    Name:  screenshot2.JPG
Views: 1096
Size:  4.3 KB
    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}

  3. #3

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,392

    Re: [VB6] - Usercontrol PropertySheet Enumeration Enhancement

    18 Dec 08. Bug/Patch Report. Zip in 1st post, contains all updates.

    Fixed major thread safety errors and tested uncompiled controls intermixed with compiled ocx's using the same subclassing technique. Now, no problems.

    Lessons learned from this bug search:
    1) VB's class function table (vTable) is aligned differently when class is uncompiled (32 bytes btwn entries) vs compiled (13 bytes). Thunk fixed to account for this by using a variable offset vs hardcoded offset
    2) Use of mapped memory file was a good idea, but failed to remember that it is cross-process capable. Therefore, data stored in it was available to any process running the compiled/uncompiled controls. Fix was simply to ensure mapped files are thread specific.

    So far, works like a champ. Please let me know if you encounter any errors.
    Last edited by LaVolpe; Dec 18th, 2008 at 11:23 AM.
    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}

  4. #4
    Junior Member Episcopal's Avatar
    Join Date
    Mar 2019
    Location
    Brazil
    Posts
    25

    Re: [VB6] - Usercontrol PropertySheet Enumeration Enhancement

    Name:  Anchor.jpg
Views: 96
Size:  49.1 KB


    hello .... Is it possible to create a property page and display it as shown?

  5. #5

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,392

    Re: [VB6] - Usercontrol PropertySheet Enumeration Enhancement

    With lots of subclassing -- yes.

    Good luck with that. It becomes even more difficult because you have to undo/prevent VB doing what it wants to do (display a combbox listing), then make it behave the way you want without breaking VB. That is rarely an easy task.
    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}

  6. #6
    Member
    Join Date
    Sep 2016
    Location
    Texas panhandle
    Posts
    39

    Re: [VB6] - Usercontrol PropertySheet Enumeration Enhancement

    Keith - brilliant as always.
    The Filename property doesn't seem to stick
    i. e. Selected a filename and the property still
    indicates (No Filename Selected) plus
    Debug.Print ucEnum1.FileName => Empty string

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width