Solved

CoolBar: how to save and restore the layout

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System restore point 4 91
Wininet read php file from internet issue 6 81
indy Tmemory stream non latin charcter issue 2 98
Delphi XE10 Round Image 2 78
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

920 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

13 Experts available now in Live!

Get 1:1 Help Now