Re: a different button on a canvas

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Jul 14 1997 - 18:27:13 MEST


Hi Luca,

   try something like this (in a macro or from the command line):

TCanvas *c = new TCanvas("c")
TButton *b = new TButton("exec
aap.C","gROOT.Macro(\"aap.C\")",0.86,0.6,0.941,0.668)
c.SetEditable(0);  // to go from edit mode to button execution mode

now clicking on the button will execute aap.C.

To see how some button panels are made, do:

- go to the canvas
- right mouse button click and select item "SetLineAttributes"
- go to Attribute window and right click in the gray background
- select "Print" and give filename.C
- examine the file filename.C, it contains the full macro to
  create the SetLineAttributes panel. Close the current panel
  and do: .x filename.C
  it should produce an exact, working, copy of the original.

Cheers, Fons.

  
Luca Sfarzo wrote:
> 
> Hello,
> 
> I'd like to decide by myself the name (and the action!) of the button
> that appear on a canvas, i.e I do not need Edit or Inspector, but other
> buttons with other actions and I would not use the control bar that
> creates a new control bar.
> Is there an option or a method to set the button that appear on a
> canvas?
> 
> Many thanks, Luca Sfarzo

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:20 MET