Skip to main content
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Uniface 9: Columnwidth in tree widget.

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

27 replies

Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

There was a documentation error in Uniface 9.6.01. We planned to make it possible to set the window size in character cell. But we retracted it at the last minute because it was very misleading. When setting the size of a window, you set the outer size, including frames and headers. Not the size of the canvas. So you would set the width of the window to 20ch and the canvas still would only fit something like 18.2 characters. Unfortunately we were too late in removing it from the documentation so it was removed from there in the next patch. We are sorry for the confusion this may have caused.


Author: Theo Neeskens (tneeskens@itblockz.nl)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

Because I want my window to show a range of characters. I was pushed to develop the calculations above for $windowproperties with 9.6.02. In 9.6.02, the helpfile reads: 2. Position and size is set in pixels (for example, 235 or 235px) and returned in pixels. while the 9.6.01 it was: 2. Position and size can be set in pixels (235 or 235px) or character cells (17ch). When getting the size or position, the property value is always in pixels.


Author: ulrich-merkel (ulrichmerkel@web.de)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

ulrich-merkel said you prepare 2 forms: FORM1010 with size 10 col * 10 lines and FORM2020 with 20 col * 20 lines. for both forms, you open them up, and require the XSize and Ysize via $windowsproperties. And then calculate with the DIFFERENCE of these sizes which relates to 10 columns and 10 lines respectively. So you get the conversion Factor in horizontal and vertical direction. factorX = (Xsize(FORM2020) - Xsize(FORM1010)) / 10 factorY = (Ysize(FORM2020) - Ysize(FORM1010)) / 10

After we have the factors, we can calculate what is the overhead for Caption, titelbar, borders of a window as: OverheadX = Xsize(FORM1010) - 10*factorX OverheadY = Ysize(FORM1010) - 10*factorY


Author: ulrich-merkel (ulrichmerkel@web.de)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

Sounds perfect.


Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

What if we get the option to supply pixel value's in the format property? Now it looks like: $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; CL; where number gets multiplied by the cell size (width) under wather to get the correct column width. If we support $fieldproperties("FIELD")="FORMATS=CL100px·!CL250px·!TC6·!TL117px·!CL·!CL60px·!TL170px; CLpx which skips the multiplication since the value is in pixels. Defined by the 'px' after the number. It looks to me that this would solve the mentioned issue's. What do you think? Jasper


Author: Jasper (jasper.de.keijzer@compuware.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

diseli said I hope you realize that $windowproperties will return the size of the "complete" window and that includes the title bar and border. In case you are using $paintedfieldproperties then you actually are interested in the size of the form canvas (this is what's inside the window borders and title bar). Currently there's no way to query the size of the canvas using a 4GL function. There are, however, ways to do this by calling the Windows API (using C Call-Out signatures). If I find some time then I'll try to dig out a little sample.

I had kind of decided that must be what it was, which required some footling about guessing how big the title bar was. Also, you can't tell the size of the displayable area for a tab widget either by using $windowproperties in the tab form, or by using $paintedfieldproperties on the tab widget. (I don't think)


Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

All in all, I'd prefer a method of setting the columnwidth in pixels. ...... I vaguely recall something being said somewhere about $paintedfieldproperties being made pixel level (was that Uniface 10?). There seems to be a lot of nasty bodging required to do anything clever in this area at the moment.

Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

Hi Iain,

FiresongKt said 1. The $cellinfo documentation appears to have XSIZE for height and YSIZE for width, and the data that comes back seems to be the other way around.

This is incorrectly documented and I've asked that it's corrected - XSIZE is of course the width and YSIZE the height.

FiresongKt said I had a similar problem before when I was trying to change the depth of a text box on a multi occurrence form, when there are 6 occurrences painted, and only 2 in use, move the fields from occ 2 and make the text boxes deeper. The problem there was that $windowproperties returns pixels for the window height, and $paintedfieldproperties can only set xpos and ypos in characters (or the other way around), requiring bodging using $cellinfo, (it turns out that the values in $cellinfo do not map properly in this case and I had to apply a fudge factor to stop the fields overlapping.)

I hope you realize that $windowproperties will return the size of the "complete" window and that includes the title bar and border. In case you are using $paintedfieldproperties then you actually are interested in the size of the form canvas (this is what's inside the window borders and title bar). Currently there's no way to query the size of the canvas using a 4GL function. There are, however, ways to do this by calling the Windows API (using C Call-Out signatures). If I find some time then I'll try to dig out a little sample. Hope this helps. Kind regards, Daniel


Author: diseli (daniel.iseli@uniface.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

Hi Iain, to get the conversion factor from char to pixels is relatively easy: you prepare 2 forms: FORM1010 with size 10 col * 10 lines and FORM2020 with 20 col * 20 lines. for both forms, you open them up, and require the XSize and Ysize via $windowsproperties. And then calculate with the DIFFERENCE of these sizes which relates to 10 columns and 10 lines respectively. So you get the conversion Factor in horizontal and vertical direction. factorX = (Xsize(FORM2020) - Xsize(FORM1010)) / 10 factorY = (Ysize(FORM2020) - Ysize(FORM1010)) / 10


Author: ulrich-merkel (ulrichmerkel@web.de)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:33 AM UTC

Columnwidth in tree widget.

Author: i.sharp@pcisystems.co.uk (Iain Sharp)

When the tree widget list view column sizes are altered, it now fires an extended trigger called columnwidth. When I define the column sizes, using $fieldproperties("FIELD")="FORMATS=CL10·!CL25·!TC6·!TL17·!CL·!CL6·!TL17·!CL13·!CL25·!CL·!CL25·!CL·; LABELS=Reference·!Location·!CHS·!Due Date·!Owner·!Priority·!Date Last Amended·!Contact·!Stock Item·!Cus. Order Ref.·!Developer·!Tester" I have been using character counts. If I resize the 4th column in the tree the columnwidth trigger gets ID=3 (because 1st column is Id 0), and width=117. Does anyone have a good tip as to what one could do WITH this information to make it useful for the next time around, I'd like to store the user's preferences for column sizes and reset the column widths to those the next time, but I don't know a sane way to translate 117 (or whatever) to TL17? What do you do about part characters? Or is there a method of telling the $fieldproperties to reset the columns in pixels? If not, what's the point of this trigger? Confused

Oh, sorry, I didn't point this out, width is the number of pixels wide, definitely. The question is more, "If proc can only set the width of a tree widget column in integer character sizes, and columnwidth is returned in pixels. How can you convert from one to the other?" or "Is there some method I don't know of to change the column width of a tree column from proc using a number of pixels." I have bodged something in using $cellinfo to get the width of a character in pixels, dividing the width parameter by that, and then setting the formats based on the integer version of that width, but :- 1. The $cellinfo documentation appears to have XSIZE for height and YSIZE for width, and the data that comes back seems to be the other way around. 2. This means the user changes his column size, and when he lets go the column gets either slightly bigger or slightly smaller (character width is 17, so it changes by up to 8 pixels because of the necessary rounding) All in all, I'd prefer a method of setting the columnwidth in pixels. I had a similar problem before when I was trying to change the depth of a text box on a multi occurrence form, when there are 6 occurrences painted, and only 2 in use, move the fields from occ 2 and make the text boxes deeper. The problem there was that $windowproperties returns pixels for the window height, and $paintedfieldproperties can only set xpos and ypos in characters (or the other way around), requiring bodging using $cellinfo, (it turns out that the values in $cellinfo do not map properly in this case and I had to apply a fudge factor to stop the fields overlapping.) I vaguely recall something being said somewhere about $paintedfieldproperties being made pixel level (was that Uniface 10?). There seems to be a lot of nasty bodging required to do anything clever in this area at the moment.


Author: Iain Sharp (i.sharp@pcisystems.co.uk)