How to hide border around TRadioGroup - c++builder

I have two radiobuttons in a TRadioGroup. All the logic behind how they are supposed to work is fine. But the TRadioGroup controler has a frame around it that I thought I would be able to delete using a border property or something like that. But the control doesn't seem to have any property that bears any resemblance to a border/frame. How do I set the controler to not include a frame?

TRadioGroup does not support what you are looking for. Place two TRadioButton components onto a TPanel instead. Then you can make it look how you want.

I don't think you can hide the border on a standard radio group box. It looks like you could create a custom descendant and override the painting if drawing normally, but that approach could be a bit more involved with theme support. Overall it sounds like a lot of work to go that route.
The next most obvious approach is to replace the radio group with a number of individual radio buttons on a container such as a panel. That would work and would be simple code but it could get messy. It seems a lot of busy work for little gain and I am lazy enough to look for another option.
There is a kludge you can use. If you put the radio group on a panel rather than directly onto the form (or other background) you can make the panel under-sized compared to the radio group. You want the panel to be as big as the interior of the radio group but not as big as the border. Then set the top and left of the radio group to negative numbers so that the border falls outside the parent panel. The border is not visible this way.

I know it's not best practice but I had a similar issue and couldn't redesign everything. So I did this to simply hide the border (and works great so far).
HANDLE Region = CreateRectRgn(3, 3, RadioGroup->Width-3, RadioGroup->Height-3) ;
SetWindowRgn(RadioGroup->Handle, Region, true);

Related

How to determine the Z order of multiple visible forms in Delphi?

Using Delphi 7. There are, among other components, 4 non-modal visible forms over a TPanel (the TPanel is the parent of the forms). I use Show, Hide, BringToFront, SendToBack on the various forms and it works fine.
The problem is that at any point in time I would like to programmatically determine the Z order of the forms. For example, Form2 is on top, behind that is Form3, then Form1, and last is Form4.
Or put it in a slightly different way: given any two non-modal, visible forms, e.g. Form2 and Form3, how to determine programmatically which one is above the other?
I tried Screen.Forms, but it doesn't work -- it always gives me the forms in the same order, regardless of the actual visible Z-order of the forms.
I read about the Windows functions GetTopWindow and GetNextWindow but before I try to use that, I'd like to know if there is a simpler way. Especially if I just have two forms with the same parent, is there a simple way to know which of them is above the other?
Thanks for any suggestions!
Use GetWindow passing GW_HWNDNEXT and GW_HWNDPREV to traverse the Z-order.
You say that you don't want to use this method and look for something simpler. There is nothing simpler.

Icon in header row for column setup

I would like to add an icon to the header of my data grid as it is done in Thunderbird.
There is an icon that is above the vertical scrollbar, no matter the position of the horizontal scrollbar. This icon allows the setup of the columns.
In Delphi there a lot of different grid components, that allow customizations and adding icons to there cells / header cells. But I could not find any component that has an area above the vertical scrollbar that is fixed, which when clicked allows some action. I could even use the VirtualTreeView component to emulate the grid, if it turns out to be easier to customize that component.
I am looking for some guidance on what need to be done to get that functionality.
Thanks,
Thomas
VirtualTreeView in Listbox mode would be nice, because of it's speed, great documentation and ease use in MVC-like patterns. Delphi tempts to store data in the visual components themselves, which letter causes troubles. While VTW allwos the same, it also allows to acutally separate data from GUI, and i like it.
But i am surprised by your claim "which when clicked allows some action.".
Even most basic components allow it:
http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Grids.TCustomGrid.OnFixedCellClick
So could you make more detaiils, why you cannot use standard components ? with screenshot and editors, how u want it rendered, where you want to click and what kind of action should happen ?

Caption for TTabControl

I'm looking for a way of implementing a sort of inset caption before a set of tabs, something like this:
The tab set is not supposed to be multi-line, will only be horizontal and laid out at the top. However it should be correctly scrollable when there are too many tabs.
I fear I'm going to be restricted here with regard to using third-party controls, but I could use subclassing on the standard TTabControl to add the necessary changes to the standard looks and behaviour. (I don't need it to be TPageControl, because it's only the specific arrangement of the tabs that I am interested in.)
Maybe there's some way of implementing this with craftily arranged combination of standard controls, which, despite my endevours, has escaped me.
Basically, any ideas or pointers are welcome.
Oh, and additional requirement is, it should blend well with desktop themes.
Granted some time has passed, but I recently needed this style and found you can do it with the TMS Software TAdvOfficePager. It has a property FixedTabs, which I set to 1 in this case. It also has an OnChanging event where you can prevent access to a tab, in this case I used AllowChange := (ToPage > 0); Lastly, I set the first tab to disabled.
Then just style the first tab different than the rest and you can have something like this:
Have you tried to make the first tab to be the caption you want.
With some additional logic you can restrict the selection of this tab.
I don't know if you can control the style of each tab individually to make the first one look as it is not the tab.
Here is crafty arrangement of controls that will work. I have done this sort of thing in the past. Best of all it automatically handles scrolling of tabs.

Fluid Form Layout in Delphi

We have developed a software. In this software we are show and hiding a few controls on various input screens depending on various situations.
When we hid a control what happens is that the space occupied by that control is left as it is and layout looks very bad at times esp. in screens that have larger numbers of controls. Our client does not like this and has asked us to do something about this.
My question:
Is there some way by which we can create Fluid Layouts so that when a control is hidden the rest of the controls automatically adjusts themselves to fill the empty space left by the control hidden and when the control is show they should automatically make way for the control and adjust themselves accordingly.
I know we can achieve this by coding but that will require a lot of code in each screen for adjusting the layout. I am looking something which will reduce coding in each screen as there are 80+ screens.
Please suggest some way which is less error pron and can get rid of unnecessary coding in each input screen.
I think your best option is to use a component that handles the layout of your vcl controls on your form in runtime (depending on the conditions that you define). I recommend you try the Devexpress ExpressLayout Control
you can find two great demo videos here
ExpressLayout Control - How to Customize Layout Views
ExpressLayout Control - Create and Customize a Simple Layout
(source: devexpress.com)
You can check these features
Auto-Management - Control groups and individual control elements are automatically managed by the Layout Control. You never worry about pixel-by-pixel positioning.
Form auto-sizing - The form can be automatically resized to fit its contents best.
Bye.
Now, I'm not sure how complex layout you have, but I guess you can use TFlowPanel and/or TGridPanel for this. Flowpanel has a nice handling of components that change visiblity. I'm not sure how well gridpanel handles the same...
What kind of controls are you dynamically hiding, and what do you mean with auto fill space?
I do not know if it is as this simple: place controls on panels, and use align alTop/alClient/alBottom. When you hide a panel, all other panels will move automatically up.
One problem though: if you want to show a panel again, the order of panels can sometimes be screwed up... Can be fixed by manually setting .Top property, or "hide" by setting .Height := 1;
What I would do with a complex layout is actually split it up into several tabs. This has two advantages. It simplifies the form layout, and allows you to show and hide whole tabs depending on choices made in other tabs.
Raize Components have a TRzFlowPanel UI component. Does exactly what you're after.
Use TRzFlowPanel to put an empty flow panel on a form. The major difference between a traditional panel and a flow panel is the way in which controls are placed. With a traditional panel, you place a control (such as a button) in a specific location. You can freely move that control to any location within the panel using the mouse. In a flow panel, each control is placed in a specific location, regardless of where you place it with the mouse. The automatic location is controlled by the FlowStyle property. For example, using the default FlowStyle property of LeftRightTopBottom, the first control you add to the flow panel snaps to the top left corner. The second control that you add snaps next to the first control, and so on.

Frame behavior in Delphi application issue

I have an application that uses a frame extensively and needs to hide/show certain buttons depending on which form is active at the time. In order to keep the buttons neat and organized appropriately, I have put them on panels and show or hide the panels as needed for each form. My problem is when each form is initially created, the panels on the frame are out of order even though I am explicitly telling them which order to put themselves into. After I hide and re-show the form, the panels are in the correct order. Any suggestions on how to keep them in the proper order from the very beginning?
Instead of giving the panels explicit positions, try giving them alignments. They tend to stick better than way, and they do a better job of resizing if you resize the form.
You can also try using a stackpanel (or was it flowpanel?) as parent for the panels. Then you will have a order instead of a position to manipulate.
Maybe you can have a look at the DevExpress LAyoutControl? It helps us creating interfaces that always look good, no matter if we show or hide certain groups / panels. It even allows for run-time customization of the interface, if you want that!
You may try to organize them by coordinates i.e.: setting Top and Left. Unless your panels are aligned, this will always work (but it takes bit lot of work).
I had this problem and I found that the solution was to do this in FormCreate (or in a CMShowingChanged method of your frame):
MyPanel1.Align := alNone;
MyPanel2.Align := alNone;
MyPanel1.Align := alBottom;
MyPanel2.Align := alBottom;
Restore in the order that you need - this seemed to sort out the order visually.

Resources