Solved

CoolBar: how to save and restore the layout

Posted on 1997-11-11
5
269 Views
Last Modified: 2010-04-04
i do not know how to change at runtime the layout from a Coolbar because the Coolbands do not have top or height properties. if i set the properties from toolbar - this of course does not work.

thanks for help
Bernhard Angerer
angerer@eftuv1.tuwien.ac.at
0
Comment
Question by:angerer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 100 total points
ID: 1349922
Hi

Manipulating Coolbars is a bit of a nuisance, and not as easy as most other Delphi controls.  Maybe Borland got bored???

Anyway, you have to send the coolbar messages to manipulate bands.  (See function TCoolBar.UpdateItem in ComCtrls.pas.)

Here is a very simple example.  This code puts the first 3 bands onto the 1st row (each with width = 75) and any more bands onto new rows by themselves.  (Add CommCtrl to your "uses" list.)

procedure TForm1.Button1Click(Sender: TObject);
var
    i: Integer;
    BandInfo: TReBarBandInfo;
begin
    // Delete all the bands!!
    for i := 0 to Coolbar1.Bands.Count - 1 do
        Coolbar1.Perform(RB_DELETEBAND, 0, 0);

    // Reinsert the bands as we want them.
    for i := 0 to Coolbar1.Bands.Count - 1 do
    begin
        FillChar(BandInfo, SizeOf(TReBarBandInfo), 0);
        BandInfo.cbSize := SizeOf(TReBarBandInfo);
        BandInfo.fMask := RBBIM_SIZE or RBBIM_CHILD or RBBIM_CHILDSIZE or RBBIM_STYLE;

        Coolbar1.Perform(RB_GETBANDINFO, i, Integer(@BandInfo));

        if (i > 2) then BandInfo.fStyle := BandInfo.fStyle or RBBS_BREAK;

        BandInfo.hwndChild := Coolbar1.Bands[i].Control.Handle;
        BandInfo.cx := 75;
        BandInfo.cxMinChild := Coolbar1.Bands[i].MinWidth;
        BandInfo.cyMinChild := Coolbar1.Bands[i].MinHeight;
        Coolbar1.Perform(RB_INSERTBAND, i, Integer(@BandInfo));
    end;
end;

This sample is a bit rough and ready.  I have inherited a new component from TCoolbar which allows you to manipulate bands better.  It works kind of like the Top & Height properties you were referring to.  I can e-mail it to you if you want...

Regards,
JB
0
 
LVL 2

Expert Comment

by:freter
ID: 2373955
JimBob,

I am interested in the derived coolbar component you mentioned. Could you please send me a copy to freter@gmx.net?

TIA,
freter
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 2429461
Hi Freter

I am away on business in China for 2 weeks.  When I get back home I will send you the code.

Regards,
JB
0
 
LVL 1

Author Comment

by:angerer
ID: 2481316
thanks very much !

i also would be interested in the inherited component. my new email is
angerer@mail.ift.tuwien.ac.at

regards
bernhard
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 2507960
Hi all

I have sent you both e-mail in this regard.  Unfortunately I cannot find the component I mentioned above, but I have e-mailed to both of you a sample which allows you to manipulate Coolbar bands.

Cheers,
JB
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question