Resolve issue where MapInfo Professional 12.5.3 (64bit) Release Build 311 - WindowInfo for WIN_INFO_TABLE returns empty string

Product Feature: Programming/Scripting



The customer target is to change content of text boxes in the Layout Designer window programatically with MapBasic. In the old layout window this could be done via the table name. 

Abstract from MapInfo Help: 
String value: For Map windows, the name of the window's "CosmeticN" table. For Layout windows, the name of the window's "LayoutN" table. For Browser or Graph windows, the name of the table displayed in the window.

For Layout windows you can’t get the name of the window's "LayoutN" table.
command ist windowinfo(window_spec,10). The result is allways empty.
I create a workspace in MI 12.0.3 and can get the name of the table, open same in MI 12.5.3 and the string is empty.

The MapBasic help note at the end of WindowInfo() function:
Similarly, you can obtain the name of a Layout window's temporary table (for example, "Layout1") by calling WindowInfo( ) with the WIN_INFO_TABLE (10) attribute.

Easy to test:

print "Layoutname: " +WindowInfo(Frontwindow(),1)
print "Layouttable: " + WindowInfo(Frontwindow(),10)

should print:
Layoutname: Layout
Layouttable: Layout1

Running this in MapInfo 64bit the string is empty.


For old Layout windows, internally we considered it as a table, and hence we used to return the name of the internal table that is created for each old layout window. 

The new layout designer introduced in 12.5 onwards, does not have any such concept of an internal table, and hence returns a blank string. 

If we are opening a workspace which has old layout window, in a 64-bit of MapInfo pro, then we convert the old layout window into a new layout designer window. This is because we do not support old layout windows in 64-bit and instead convert it to the newer layout designer. And hence we do not output any name for such windows. 

This is therefore WAD (works as designed) for the new Layout Designer. 


UPDATED: September 8, 2017
To meet the customers target you can do the following in MapInfo 64bit:
  • Use WindowInfo with WIN_INFO_NAME to get the name of the layout designer window. 
  • Iterate through the list of items in the Layout Designer window. The number of items can be found by LayoutInfo with LAYOUT_INFO_NUM_ITEMS. 
  • For each item, check whether it is a text frame. 
    • This can be done by using LayoutItemInfo function with LAYOUT_ITEM_INFO_TYPE and check the type should be LAYOUT_ITEM_TYPE_TEXT. 
    • and then use 
    • Alter Designer Text to change the contents of the text frame.