?
Solved

CoolBar: how to save and restore the layout

Posted on 1997-11-11
5
Medium Priority
?
278 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 200 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

764 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