Nested Forms & Transparency

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #33372
    Jeremy©JTECH
    Participant

    I've been playing around with the AlphaControls components and I'm very impressed with what they provide, but before I purchase a site license and begin the laborious process of converting our entire program, I had a few questions.

    In most of our program, we nest forms inside other forms. With our previous visual themes we never ran into problems with this, but with the new components I'm not quite sure how to achieve the visual effect I desire. Refer to the screenshot below:

    Basically we instantiate forms, make sure they have no border, and then set their Parent property to be some panel or other TWinControl located in another form. The nested “child” form is then aligned to client so that it fills the parent panel, allowing it to know just how much room it has to work with and resize its own child controls appropriately. The code for this is rather simple:

    CODE
    void __fastcall TTrackerMainForm::Button3Click(TObject *Sender)
    {
      TForm1* form = new TForm1(this);
      form->Parent = ParentPanel;
      form->Align = alClient;
      form->Show();
    }

    The problem with this approach is that the child form's client area draws over the parent panel (in the image you can see where the parent TsPanel with skin of PANEL_LOW is overdrawn by a solid blue color, which is where the child form starts). I've tried using a TsSkinProvider component to draw the child form's client area in a transparent way (i.e. setting the skin section to CHECKBOX or MENUITEM), but with no success.

    Another quirk I noticed is that with certain skins, when speed or bit buttons are drawn in a disabled state (with dkGrayed and dkBlending enabled), you sometimes see the whole button appear slightly gray instead of just the glyph itself being gray. This is very noticeable in some skins but not at all in others, which makes me wonder if it's a property of the skin itself?

    #41004
    Support
    Keymaster

    Hello Jeremy

    I'll try to solve a problem with form transparency soon.

    QUOTE (Jeremy©JTECH @ Oct 27 2009, 09:04 PM)
    Another quirk I noticed is that with certain skins, when speed or bit buttons are drawn in a disabled state (with dkGrayed and dkBlending enabled), you sometimes see the whole button appear slightly gray instead of just the glyph itself being gray. This is very noticeable in some skins but not at all in others, which makes me wonder if it's a property of the skin itself?


    Which button type was used here? You must use Grayed property instead DisabledKind seems (DisabledKind property defines kind of all control when disabled). So, try the Grayed property.

    #41007
    Jeremy©JTECH
    Participant

    Here's another sample of what I'm talking about. Again, this doesn't happen with all skins, but a good percentage of them exhibit this behavior (the below is BlueGlass).

    Now, just to experiment, I tried using different settings for the 12 speed button controls below (I used TsSpeedButton). The six buttons on the left have the Grayed property set to true, and the six on the right have a Grayed of false. To further test how all of these properties work with each other, I set the top six to have the dgBlended, dgGrayed, and dkBlended options set. The bottom six have these same three options set and also the dkGrayed option is set.

    Now, you can see that the Grayed property has absolutely no effect, at least with the controls below. The six on the left look the same as the right. The only setting that actually causes the glyphs to properly appear grayed out is the dkGrayed option (enabled for the bottom six), but the unfortunate side effect is that the glyph area itself is also grayed. <img src="style_emoticons//unsure.gif” style=”vertical-align:middle” emoid=”:???:” border=”0″ alt=”unsure.gif” />


    #41073
    Support
    Keymaster

    Hi
    Problem with transparent child forms must be solved in the v6.50 (you must choose transparent SkinSection in SkinProvider.SkinData property, 'CHECKBOX' for example).
    I can't understand why glyphs are not grayed in buttons which have Grayed property changed to True, could you send me example please?

    #41093
    Jeremy©JTECH
    Participant

    I couldn't see an easy way to send you my sample project, so I've simply attached it to this post.

    I'm not sure why Grayed property wasn't working in my earlier form either, as it does seem to work in my sample program (but only when the button is Enabled). When the buttons are disabled, however, Grayed has no effect. For that matter, the dgBlended and dgGrayed properties don't seem to do anything either. Maybe there's a bug there?

    I love how the control blends out and goes gray when it's disabled, but I want to limit that behavior just to the glyph instead of the entire control.

    #41094
    Jeremy©JTECH
    Participant

    Also, I just tested nested forms, and it works great now. Thank you!

    By the way, what's the best skin section to use for transparency? Is CHECKBOX the best way to have panels be transparent? Would it make any sense to have a new skin section added simply called TRANSPARENT, or something like that? I ask because I use panels a lot to group a bunch of controls together and move them together in a much easier way. The controls in our forms often have to be dynamically resized or moved, and having transparent panels makes this much easier.

    That or you could maybe even just make a new component for grouping controls together. It could have properties like TPanel (Align, AutoSize, Margin, Padding, etc.) which are really useful, but it's always an invisible component. Just a thought!

    #41128
    Support
    Keymaster

    Hello and thanks for demo, I'll solve a problem soon.
    'CHECKBOX' section may be always used as empty section without problem. This section have only two lines :
    TRANSPARENCY=100
    HOTTRANSPARENCY=100

    About a new control I can't say now because many other tasks are planned already…

    #41420
    Jeremy©JTECH
    Participant

    After a bit more testing, there are still a few things with nested forms that don't appear to be working correctly. Hopefully a solution won't be too difficult. Refer to the screenshot:

    The middle area consists of a TsPanel (made transparent with a SkinSection of CHECKBOX) which serves as the Parent of my child TForm. This child form has an Alignment of alClient so it fills the entire parent panel, and it contains a TsSkinProvider component with a SkinSection property of CHECKBOX. This form also contains the TsPanel seen above (with a normal PANEL skin section) containing a button inside.

    As can be seen, the child panel doesn't appear like a normal panel would, at least for some of the more complex skins available with background images underlying the canvas of the form. The corners of the panel also look a little odd, though this is a minor complaint.

    #41423
    Support
    Keymaster

    I'll try to solve this problem in the v6.54

    #41429
    Jeremy©JTECH
    Participant

    Awesome, thanks! I know this probably seems like a weird request, but using nested child forms like this helps us keep our code cleaner and more modular, rather than having everything in one giant main form.

    #41535
    Jeremy©JTECH
    Participant

    Here's another weird thing I've noticed with using AlphaControls and nested forms:

    Before I was trying to make the child form's client area be transparent using a TsSkinProvider within the form and setting its SkinSection to CHECKBOX. You updated the controls to make this work (mostly), but now I'm thinking it would be better to have the child form completely fill out its parent's area and make itself look like a panel.

    I made a simple form with a TsSkinProvider and set its SkinSection to PANEL_LOW. When nested, the form appears to draw its borders properly (using the PANEL_LOW skin data), but the rest of its client area ends up being just a solid color (white for this particular skin). Would it be possible to get this working anytime soon?

    Edit: After some additional testing, it looks like you've already done this sort of thing for TFrames with the TsFrameProvider control. We're using TForms instead of TFrames because of all the extra methods and properties you get with forms, and trying to convert all our nested TForms to TFrames would most likely be a major pain. Among other things, TFrames don't have events that let you know when they've been made visible, closed, or destroyed, while TForms do.

    If you can basically get the SkinProvider to work for nested forms the same way TsFrameProvider is already working for nested frames, I know I personally would be very pleased. Again, I know this seems weird, but we often have multiple levels of forms all nested together, so getting them all to display properly would open the doors to all sorts of cool possibilities. Thanks again!

    #41570
    Support
    Keymaster

    Hello
    Try it again with v6.54, some changes was made there.

    #41614
    Jeremy©JTECH
    Participant

    I tried my nested form in 6.54, but with the form's skin section set to PANEL it still wasn't properly painting the inside part of the form's client (just like in my last screenshot).

    In the meantime, I've actually started changing the nested forms to all be TFrames that use FrameAdapters, and these seem to be working much better so far. I was initially thinking I couldn't get my forms to work as TFrames, but it seems now they probably will. For now I wouldn't worry too much about making nested forms work, at least not for me.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.