Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

OI10 & Tab Control

I recently added an SRP Tab control to an existing form in OI9 as I have done many times before. All works as expected. As this form has been around forever, there are several OI buttons with images in the old toolbar fashion.

No real problem with that until, the form was migrated to OI10.
With the tab control added, the OI buttons no longer display the images at runtime. They do display them in the OI10 form designer but at runtime, no images.


Remove the tab control and the buttons return to displaying as they should.

Changing the buttons to SRP buttons, (which do behave correctly), is a nice idea but not a realistic endeavour.
Too many buttons on too many forms.

Comments

  • Do these buttons need the button text? OI 10 buttons have more features, so it looks like it's centering the button contents. I bet if you remove the captions and use just the images, they would look correct.
  • Nevermind. I often forget that the SRP Tab Control manually redraws all other OI controls in order to simulate the appearance of the tab control being behind other controls. So, this is my fault.

    For now, the work around is to not set the AllowXPTheme property at all, even if you are currently setting it to 0.
  • Fortunately we're not moving production to OI10 just yet so the work around will suffice whilst we remember it.
    Will be keen to hear of a resolution when you come up with one though.
  • I looked into this. In OI 9, buttons that use a custom bitmap use an old-school technique for rendering the bitmap that involves setting a style-bit in the button calls BS_OWNERDRAW. This tells the button that OI wants to draw the button manually, which is how it renders the bitmap.

    This is how SRP Tab knows to leave a bitmap button alone. If it sees the BS_OWNERDRAW flag, it ignores the button when it subclasses other controls on the form.

    OI 10 no longer uses this technique, so the SRP Tab has no way whatsoever to distinguish between bitmap buttons and regular buttons. Moreover, SRP Tab doesn't have access to the presentation server, so it cannot access OI specific settings or the button's image. Thus, we are in an all-or-nothing situation. If you want to preserve the old bitmap buttons, you'll need to avoid setting the AllowXPTheme property at all, which means other controls will look funky when place within the SRP Tab pane.

    It would seem the path of least resistance would be to upgrade your buttons to OI 10 buttons or SRP Buttons.

    This is one of several reasons why moving to OI 10 is a port, not an upgrade.
  • Fair enough.
    Thanks for looking into it Kev.
    We'll change the buttons to SRP buttons wherever we've implemented the SRP tab.
    Looking at it from that perspective, it's not as big a job as first perceived.

    We'll just now know that moving forward, if we switch an OI "Tab" to the SRP tabcontrol, it will include the changing of the buttons as well. Switching the tabs was a relatively quick way to improve overall appearance. Will still follow that path but will likely be a little more selective as to when.
  • @AusMarkB - You caught that you can also use OI 10 buttons, correct? This might be a better solution than switching over to SRP buttons.
  • Thanks @DonBakke, yep I did.
    The scenario is, we're still developing in OI9 and then periodically porting to OI10 so that when we're ready, we're ready.
    Changing to SRP buttons in OI9 means doing it once. Changing to OI10 buttons means redoing it everytime we recreate the OI10 environment.
  • As suggested by Keven, just tried adding a new push button in OI10 with an image and the new OI10 button does not display the image. Also tried using one of the RTI images without success. Not sure if setting the AllowXPTheme property is compatible with OI10.
  • The scenario is, we're still developing in OI9 and then periodically porting to OI10 so that when we're ready, we're ready.
    Changing to SRP buttons in OI9 means doing it once. Changing to OI10 buttons means redoing it everytime we recreate the OI10 environment.

    Ah, yes, that makes sense.
  • edited December 2021
    Chris, you might be right. I'll have to investigate further, but it might be the same issue. If the OI 10 button has a Window Class name of "BUTTON" and does not use the BS_OWNERDRAW, we're in the same boat.

    We always suspected the SRP Tab would be problematic in OI 10. SRP Tab was the second control ever created, back in OI 4.x, and it does a ton of hooking, clipping, subclassing, and custom drawing to make the effect work. Since OI 10 has a new composition-based presentation server, it's likely all those smoke-and-mirrors are causing havoc.

    OI 10 has improved its controls a lot. We do recommend using them whenever possible. I figure the future of SRP Controls will be specialty controls.

    OI 10 really is a different beast. Moving from OI 9 to OI 10 is more akin to moving from AREV to OI.
  • Any progress on the incompatability between button image and SRP tab control. Just installed a new copy of the latest OI10.1 beta test and still have the button image issue. What is the best solution?
  • I don't have a solution other than to recommend against using the AllowXPTheme property. I have no access to the image from within the SRP Tab control in order to render it properly.
Sign In or Register to comment.