Resize of explorer columns

I need some code to append to existing code that will auto-resize all columns of an explorer window s when they are created by the batch process.
They should automatically expand to the width of the header name or contents, whichever is wider.
I also need a way to describe the header with a mouse-over of some kind if possible.

There isn't code required to auto-resize explorer columns.

Just do this...

To auto resize all columns at once LMB (left mouse button) click into analysis result list and then hit keyboard combination:

CTRL + SHIFT + Numpad's "+" key

Also there is an analysis toolbar option to auto resize. So just check "Auto-resize columns to fit content" of analysis settings drop down menu.

5111

No, there is no tooltip feature for explorer headers if hovering mouse over them.

2 Likes

Thank you.

I got this message when clicking on settings

dayexit_time = 145500;// Chicago time
if( NOT StrFind(Name(), "-OPT") && Name() != "~~~EQUITY" )
Error(
------^
Error 99.
Apply the code on Option symbols but not on underlyings!

The error message says to select option symbol which apparently you haven't.

But I think in addition you have clicked parameter button but not the actual analysis settings button.
The correct button to click is this one (and there to click -> the small arrow on the right side).
813

2 Likes

I was in the wrong place. Thank you again.

Another anomaly but probably not a big deal?
Regardless of the symbol presented in the results of the BacktestProject tab, it seems to report AAPL by default in the general tab of that Backtester settings window.

@tedpenner To adjust the column width to display the full column header name - add [width = 100] to the end of your AddColumn code.

EXAMPLE: [AddColumn Code here],width = 100;

By adding: [width = 100] to the end of your [AddColumn] code fixes the Column Width to include the [COLUMN HEADER] full name.

@fxshrat The "Auto-size" feature is designed to auto-size [COLUMN CONTENT] and it will compresses the [HEADERS CONTENT] to achieve this -- Sometimes when selecting this feature the HEADERS can become unreadable.

Skate.

What you are saying here is wrong (at least being proven in my tests) as it will not compress headers (Show an AFL example where it does not work!). Or perhaps you are not using most recent AB version.

Filter = 1;

SetOption( "NoDefaultColumns", True );

AddColumn( C, "PRICE_OF_WHATEVER_SYMBOL_THERE_IS_IN_WATCHLIST", 1.4 );
AddTextColumn( "b", "blablablabla", 1 );
AddTextColumn( "bbb", "blablablabla", 1 );
AddTextColumn( "bbbbb", "blablablabla", 1 );
AddTextColumn( "bbbbbbbbbbbbbbbbbbbbbbbbbbb", "blablablabla", 1 );

Watch this animation below and see what happens if auto-size feature does its action (as you can see first four columns have headers with longer content to display and last column has longer cell content than header. In all cases of test AFL content is getting auto-sized just fine - meaning all content is adjusted to the longest one, no matter if it is header or result list content)):

test

Also auto-sizing backtest result list and headers works fine on my end (No single compression of header content).

Backup what you claim via actual EXAMPLES! We are not sitting in front of your PC.

1 Like

@fxshrat - What I'm saying is not wrong..

  1. Backup what you claim via actual EXAMPLES! We are not sitting in front of your PC.
  2. What you are saying here is wrong (at least being proven in my tests) as it will not compress headers (Show an AFL example where it does not work!). Or perhaps you are not using most recent AB version.

0

Watch this animation below and see what happens when auto-size feature is selected (as you can see the [HEADER] columns COMPRESS to display unreadable headers.

In all cases of test AFL the column content is getting auto-sized just fine - BUT - the [Headers] get compressed & unreadable - meaning our experience differs.

Auto%20Column

@tedpenner - "They should automatically expand to the width of the header name or contents, whichever is wider".

My simple solution overcomes an issue @tedpenner is experiencing (IMHO)

I HOLD MY POSITION
The "Auto-size" feature is designed to auto-size [COLUMN CONTENT] and it will compresses the [HEADERS CONTENT] to achieve this -- Sometimes when selecting this feature the HEADERS can become unreadable.

Skate.

Where is your reproducible AFL example?
I still can not see any example explorer code example to test.
I repeat we are not sitting in front of your PC.
Why have you not gone to technical support to fix possible issues?

Instead we have to start guessing game here...
So by looking at your animation you seem to have added SetSortColumns() function to your AFL! Perhaps that one is causing the header not being fully visible (Just a guess not a fact). As you can see in your animation the sorting arrows are part of the header and overlapping text! Comment SetSortColumns line and re-do your test. My guess is that then you will see no header compression.

Fact remains auto size is supposed to work on all content since header is part of a column (also been proven by my example code and animation)!

EDIT: I added SetSortColumns to my upper test code and as you can see then headers are not fully enlarged! So reason seems to be SetSortColumns indeed! Got to AmiBroker support to ask for fix.
5439

This one is a reproducible example code

Filter = 1;

//SetOption( "NoDefaultColumns", True );
SetSortColumns( 1, -2, 3, 4, 5, 6, 7 );

AddColumn( C, "PRICE_OF_WHATEVER_SYMBOL_THERE_IS_IN_WATCHLIST", 1.4 );
AddTextColumn( "b", "blablablabla", 1 );
AddTextColumn( "bbb", "blablablabla", 1 );
AddTextColumn( "bbbbb", "blablablabla", 1 );
AddTextColumn( "bbbbbbbbbbbbbbbbbbbbbbbbbbb", "blablablabla", 1 );

If commenting SetSortColumns line then there is full visibility of all headers again!

935

BTW, please use proper quote tags. Using italic style for quotes is distracting as reader has to find out whether it could be your text or someone else's one.

2 Likes

@fxshrat EDIT: I don’t need support as my piece of code overcomes the issue of Header Compression when using SetSortColumns.

Skate.

@fxshrat @portfoliobuilder @Milosz I posted a simple solution to overcome Header Compression if SetSortColumn is part of the .afl

Adding:
[[ ,width = 100 ]] to the end of [[ AddColumn ]] fixes the issue. Without this additional piece of code the FULL Header description is not displayed.

Selecting:
[[ Auto-size columns to fit content ]] compresses the Headers further when SetSortColumn is part of the .afl code making the Column Headers unreadable.

I've reported the issue as there may be a better solution that could be implemented to overcome others who experience Header Compression when using SetSortColumn as part of their code.

Skate.

Nothing to fix as this is Windows feature. Column width can't change depending on whenever you are sorting given column or not. Column width is calculated based on text extent not anything else.
If sorting arrow is added and there is no room then ellipsis (...) is added. This is how things work globally in Windows.

1 Like

@Tomasz,

I've noticed with the Auto-Fit feature, if all the rows in the screen view (range) in the column are null values but some rows below the screen range do contain values the Auto-Fit feature doesn't activate.

AmiBroker 6.35.1
Windows 7 (64 Bit)

Null values and some values all in screen range (Auto-Fit activates):

image

All null values in screen range and some values below screen range (Auto-Fit doesn't activate):

image

Below screen range:

image