Solved

CoolBar: how to save and restore the layout

Posted on 1997-11-11
5
264 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
  • 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now