Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   TCategoryButtons (https://www.clubdelphi.com/foros/showthread.php?t=47750)

scriptors 06-09-2007 10:49:07

TCategoryButtons
 
¿Algún ejemplo?

No consigo que el resto de categorías se "autocolapsen" cuando se abre una de ellas.

Cita:

Empezado por Mensaje original en inglés
some example ?

I can't make functional autocollapse buttoncategory when one are opened :(


poliburro 06-09-2007 18:01:28

Amigo, bienvenido al club, creo que te haría bien darle una leida a la guía de estilo.

Suerte

jhonny 06-09-2007 18:08:16

Estoy de acuerdo con poliburro, la verdad es que es muy complicado ayudarte si no nos das mas detalles.

P.D. La guia de estilo esta en http://www.clubdelphi.com/foros/guiaestilo.php.

dec 06-09-2007 18:15:02

Hola,

El caso es que tiene su miga. Resulta que el componente tiene un evento "OnCategoryCollapse" que se dispara cuando se colapsa o expande una categoría. Yo he intentado ahí que cuando una categoría se expanda el resto de colapse (que creo que es lo que necesita el compañero), pero, nada, que no ha habido manera.

scriptors 07-09-2007 10:43:47

thanks for replay,
I'm Italian so it's easy to 'read' your language but difficult to write ;)

I read all founded page with google or yahoo about TCategoryButtons without found nothing functional :(

I know:

Código:


procedure Form1.SelectCategoryCollapase(Sender: TObject;
  const Category: TButtonCategory);
begin
...
end;

but after too many test i haven't realized one working routine.

The BEST strange things are:
if I make one routine and write, at beginnig, one

Showmessage( {variable.get} ); // just for example
I have one working procedure, if I delete the 'ShowMessage' I have one NOT working procedure and system error :confused::confused::confused:

I beginning to think this component have some BUG ... or I have more BUG of it :D

_________________________

Because I found less example about this component i post some functional example I have found/discovered/realized:

Create Items into Group (I use it into While .. do routine):

var
aButton : TButtonItem;
NPNL : integer;

...
abutton := select.categories[1].items.add; // add button item into TCategoryButtons (called 'select') into categoryGroup n.1
abutton.Caption := 'some text' ; // add TextName of button item
select.Categories[1].items[NPNL].onclick := Gruppo1; // add OnClick property (procedure: Gruppo1) - NPNL is one integer and are incremented into While cycle or somethings you like
------------------

procedure Form1.Gruppo1(Sender: TObject);
var
Pulsante: TButtonItem;
Riga : integer;
begin
...
Riga := 0;
Pulsante := Select.SelectedItem; // select are Name of TCategoryButtons
Riga := Pulsante.Index; // Riga are Item Clicked
...

_________________________

dec 15-03-2015 15:28:26

Hola,

Cita:

Empezado por dec (Mensaje 228909)
Hola,

El caso es que tiene su miga. Resulta que el componente tiene un evento "OnCategoryCollapse" que se dispara cuando se colapsa o expande una categoría. Yo he intentado ahí que cuando una categoría se expanda el resto de colapse (que creo que es lo que necesita el compañero), pero, nada, que no ha habido manera.

Sin embargo, algo así parece funcionar como se espera:

Código Delphi [-]
procedure TToolsDockForm.CategoryButtonsCategoryCollapase(
 Sender: TObject; const Category: TButtonCategory);
var
  I: Integer;
begin
  CategoryButtons.OnCategoryCollapase := nil;
  for I := 0 to CategoryButtons.Categories.Count - 1 do
  begin
    CategoryButtons.Categories.Items[i].Collapsed :=
     CategoryButtons.Categories.Items[i] <> Category;
  end;
  CategoryButtons.OnCategoryCollapase :=
   CategoryButtonsCategoryCollapase;
end;

:cool: :eek: :D


La franja horaria es GMT +2. Ahora son las 04:26:28.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi