Dynamicaly configuring the toolbar

Apr 13, 2010
301
7
61
The Hague
I would like to add/remove buttons to/from the toolbar depending on the presence of software on my system.

After hours of trying different versions I still haven't found the correct syntax.

For example:
I want my TCSTART to contain generic code only and run an extra batch with specific initialisation in a separate console for Perl.

Something like

Code:
IFF ISFILE C:\Perl\bin\perl.exe THEN
[INDENT]SET tab=Consoles
SET btn=n
SET flg=256
SET icn=C:\Perl\bin\perl.exe
SET ttl=Perl5
SET dir=C:\Develop\Perl
SET cmd=%ComSpec StartPerl.BTM
TCTOOLBAR %tab %btn, %flg, %icn, %ttl, %dir, %cmd
[/INDENT]ENDIFF

What is the correct syntax? Why does the Help text show the first two parameters separated by spaces and the rest by comma's? The docs describe the value of the flags to be both zero-based and 256-based. Which is correct or what is the difference? If different combinations of parameters accomplish different things, which is for what?

Please help.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,423
85
Albuquerque, NM
prospero.unm.edu
I would like to add/remove buttons to/from the toolbar depending on the presence of software on my system.

I think that the way it's supposed to work is:

The first parameter, "tab", is optional; the command knows you've supplied it because it's terminated with a space, not a comma. This parameter is supposed to indicate the toolbar tab you want to modify -- either the section name in the .INI file or the title as set by a Title= directive, I'm not clear which. Either way, it should be a string. If you don't supply this parameter, TCTOOLBAR should assume the currently selected tab.

The second parameter (or first, if "tab" isn't present) is the number of the button to modify: 1 for the first button on the tab, 2 for the second button, and so on. This parameter must be an integer; TCTOOLBAR aborts with an error if it isn't. The remaining parameters are as documented.

BUT: I don't think that the command parser is actually working as intended. If you do supply the optional "tab" parameter, the command doesn't recognize it and gorks because it's expecting an integer. If you don't supply it, the command incorrectly defaults to a null string rather than the section name (or title?) of the current tab. If you use TCTOOLBAR with the /U option and no "tab" parameter, you'll see that your button definition is written to the .INI file in a section with an empty [] header.
 
Apr 13, 2010
301
7
61
The Hague
Thank you Charles, for taking the time to respond. It does feel lonely sometimes, without anyone to spar with.

IMHU The documentation goes from being unclear via contradicting itself to downright wrong.
TCTOOLBAR [/C /R file /U /W file] tab button [,flags, icon, title, directory, command] is at least unclear.

If I try to put your remarks and my experience in a still imperfect but better understandable definition of the syntax,
it reads something like this:

Code:
TCTOOLBAR /C | 
          /R filename <FILENAME>| 
          /U | 
          /W filename<FILENAME>| 
          [ | nTabNr | strTabName ] nButton 
          [, nFlags, [ strIconSpec, <ICONFILENAME>] strTitle, [strPath, ] strCommand ]
Which does not look very elegant. It also means:
- no parameters is an error.
- "/U filename" <FILENAME>is an error.
among other things.
But still, I'm unsure about that most important last line of the syntax def.
I think in some cases the path is optional too. Let's experiment.
Code:
:: Clear the TB
TCTOOLBAR /C
:: Load a def that's known to work. (See example below)
TCTOOLBAR /R TB_def1.INI
:: Now, let's add a button, not mentioning any tabs.
TCTOOLBAR 3, 261, "Wide Dir", "C:\", "DIR /W" Enter
TCTOOLBAR 3, 261, Wide, "C:\", "DIR /W" Enter
TCTOOLBAR 3, 261, Wide, C:\, "DIR /W" Enter
:: Okay, forget the darn' separator
TCTOOLBAR 3, 256, "Wide Dir", "C:\", "DIR /W" Enter
TCTOOLBAR 3, 256, Wide, "C:\", "DIR /W" Enter
TCTOOLBAR 3, 256, Wide, C:\, "DIR /W" Enter
:: Looking at an example from an earlier version of TCMD,
:: I changed the flags again.
TCTOOLBAR 3, 2, "Wide Dir", "C:\", "DIR /W" Enter
TCTOOLBAR 3, 2, Wide, "C:\", "DIR /W" Enter
TCTOOLBAR 3, 2, Wide, C:\, "DIR /W" Enter
:: Still, no luck.
:: In the forementioned example the parameter pattern was:
 <NUMBER> <NUMBER><STRING>"<STRING>"
 
:: Let's try that, skipping the dir parameter
TCTOOLBAR 3, 2, "Wide Dir", "DIR /W" Enter
TCTOOLBAR 3, 2, Wide, "DIR /W" Enter
TCTOOLBAR 3, 2, Wide, `"DIR /W" Enter`
:: It seems nothing works
In all of the above cases the result is (1) no errormsg (2) the first button disappears
and (3) the saved definition is left unchanged (4) any further attempt removes
the toolbar altogether.

Something else I noticed.
The TCTOOLBAR /R option is not additive like SET /R or ALIAS /R.
If you create two files with the folowing content:

Code:
 TB_def1.INI:
  [Toolbar1]
  Title=Tab1
  B1=257,,Clear screen,,,"CLS" Enter
  B2=261,,MyDir,,,"PDIR" Enter

Code:
 TB_def2.INI:
  [Toolbar2]
  Title=Tab2
  B3=261,,Desktop,,,"*CDD /T dt:" Enter
  B4=261,,Development,,,"*CDD /T dev:" Enter

TCTOOLBAR /C
Clears everything

TCTOOLBAR /R TB_def1.INI
Creates the toolbar as expected. Let's create an INI-file.

TCTOOLBAR /W first.ini
The result reads:

first.INI:
[Toolbar1]
Title=Tab1
B1=257,,Clear screen,Algemeen,,"CLS" Enter
B2=261,,MyDir,Algemeen,,"PDIR" Enter
That's okay too. Now, let's load the definition of the second bar.

TCTOOLBAR /R TB_def2.INI
GUI: we get three (!) tabs: "Untitled", "Tab2" and "Tab1".
If we write out the definition like so:

TCTOOLBAR /W second.ini
That second file has the following content:

second.INI:
[Toolbar1]
Title=Untitled
[Toolbar2]
Title=Tab2
B1=261,,Desktop,,,"*CDD /T dt:" Enter
B2=261,,Development,,,"*CDD /T dev:" Enter
The second (non-overlapping) definition has more or less destroyed the first.
Notice the button numbers in the second definition have been changed too.


So, back to my original posting.
Ideas anyone? Does anybody have a single working command? That might at least give me
a starting point. Some solid ground to base further experimentation on.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,423
85
Albuquerque, NM
prospero.unm.edu
<filename><filename><iconfilename><filename><number><number><string><string>Does anybody have a single working command?

I sure don't. But searching the forum for 'TCTOOLBAR' shows someone else asking the same questions you are, about two months ago....

</string></string></number></number></filename></iconfilename></filename></filename>
 

rconn

Administrator
Staff member
May 14, 2008
12,314
147
> I would like to add/remove buttons to/from the toolbar depending on the
> presence of software on my system.
>
> After hours of trying different versions I still haven't found the
> correct syntax.

The reason you couldn't find the right syntax is because there is an error
in the documentation (it's missing one argument). After correcting that I
found a bug in the TCTOOLBAR code that could trigger depending on the
existence of one of the optional arguments. I should have a corrected build
uploaded in the next day or two.

Rex Conn
JP Software
 
Similar threads
Thread starter Title Forum Replies Date
H Configuring the location of BATCH.BCP in the INI file Support 0
Jay Sage Testing for Presence of Toolbar Support 5
C Fixed V25 crashes when adding and then removing in the tabbed toolbar Support 3
vefatica Start VIEW with the toolbar showing? Support 5
vefatica VIEW ... remember no toolbar Support 0
Glenn Bowes WAD TOOLBAR Button Definations are different v19 to v20 Support 8
Alpengreis [v19.0.32 (x64)] Problem with [Options, Tabbed Toolbar, Add Button] in german language Support 1
D V19: toolbar /r "path\tctoolbar.ini" Support 1
vefatica Fixed Crash removing toolbar tab Support 1
vefatica Tabbed toolbar hidden ... not remembered! Support 11
rps Fixed Configure TCMD/TCC Tabbed toolbar buttons not persistant Support 3
Jay Sage Getting Quote Characters into a Toolbar Tab Support 12
Jay Sage Toolbar Update to INI File Not Working Support 10
D TCMD16 Delete Toolbar Button bug Support 7
Jay Sage Positioning of Tabbed Toolbar Support 4
vefatica Tabbed toolbar? Support 7
cgunhouse ToolBar Button Problem Support 11
T TCTOOLBAR /C & TCTOOLBAR /I should reload toolbar from TCMD.INI, right? Support 1
E Problems with Tabbed Toolbar Support 2
scottb Toolbar filter by directory attribute /A:D fails Support 1
Jay Sage More on Problem with Tabbed Toolbar Support 0
Jay Sage Problem With Tabbed Toolbar Support 1
S "Tabbed Toolbar" doesn't seem to work Support 16
Jay Sage Version 12: No Option to Configure Toolbar Support 2
williamleara Can't Close TakeCommand After Adding 2nd Toolbar Tab Support 3
R Toolbar - save to .INI Support 4
G Display setting for Tabbed Toolbar Support 1
Phileosophos Toolbar Buttons Disappear Support 1
Jay Sage Toolbar Problem with Reloading from INI Support 0
Jay Sage Issue With Reloading Toolbar From INI File Support 0
Jay Sage Issue With Adding Buttons to Toolbar in Build 30 Support 0
P Toolbar configuration anomaly Support 5
Jay Sage TCMD11 Toolbar Issues Support 2
J V10 "Configure tab toolbar" issues Support 3
A Cannot permanently remove Tabs toolbar using View menu - bug? Support 8
O Problems opening an app in a tab from the toolbar Support 28

Similar threads