| Author |
Topic  |
|
|
AKazak
Russia
1228 Posts |
|
|
cpyang
USA
1406 Posts |
Posted - 05/04/2020 : 3:39:30 PM
|
OriginC allows detailed controls on how you resize the columns, but there was no LabTalk to simulate that automatic width in 2019b. This was added in 2020b as all the Mini Toolbar buttons are executing some labtalk commands, and there is such button introduced in Origin2020b.

If needed, I can provide some Origin C sample code so you can do this in 2019b.
CP
|
 |
|
|
AKazak
Russia
1228 Posts |
Posted - 05/04/2020 : 4:10:56 PM
|
quote: Originally posted by cpyang
OriginC allows detailed controls on how you resize the columns, but there was no LabTalk to simulate that automatic width in 2019b. This was added in 2020b as all the Mini Toolbar buttons are executing some labtalk commands, and there is such button introduced in Origin2020b.

If needed, I can provide some Origin C sample code so you can do this in 2019b.
CP
OK, I see. Please provide the OC snippet.
Thank you. |
 |
|
|
cpyang
USA
1406 Posts |
Posted - 05/04/2020 : 4:42:51 PM
|
The following the the simplest code, and there can be so many different things you can do with it.
void autos()
{
DWORD dwCntrl = AS_INVALIDATE;//|AS_NOHEIGHT
Worksheet wks = Project.ActiveLayer();
OGRIDLIMITS limits;
init_autosize_limits(&limits, -1, -1, -1, -1);
wks.AutoSize(dwCntrl, 0, &limits);
}
The prototype for init function is
init_autosize_limits(OGRIDLIMITS *pLimits, double dminCol = 1.5, double dmaxCol = 25, double dminRow = -1, double dmaxRow = -1);
so using -1 is to indicate not having any limits.
CP
|
 |
|
|
AKazak
Russia
1228 Posts |
Posted - 05/05/2020 : 04:52:22 AM
|
quote: Originally posted by cpyang
The following the the simplest code, and there can be so many different things you can do with it.
void autos()
{
DWORD dwCntrl = AS_INVALIDATE;//|AS_NOHEIGHT
Worksheet wks = Project.ActiveLayer();
OGRIDLIMITS limits;
init_autosize_limits(&limits, -1, -1, -1, -1);
wks.AutoSize(dwCntrl, 0, &limits);
}
The prototype for init function is
init_autosize_limits(OGRIDLIMITS *pLimits, double dminCol = 1.5, double dmaxCol = 25, double dminRow = -1, double dmaxRow = -1);
so using -1 is to indicate not having any limits.
CP
Great! Please clarify the meaning of AUTOSIZE setting. https://www.originlab.com/doc/OriginC/ref/AUTOSIZE doesn't say too much. What is the difference between AS_INVALIDATE and AS_NOHEIGHT? |
 |
|
|
Chris D
428 Posts |
Posted - 05/05/2020 : 08:10:22 AM
|
Hi,
The AS_NOHEIGHT flag tells Origin to not autosize the height of cells/rows. The AS_INVALIDATE flag tells Origin that it needs to redraw the columns at their new width. The | operator combines two or more flags.
So if you specified AS_NOHEIGHT | AS_INVALIDATE, you are telling Origin to both ignore resizing height and to force redraw.
I hope this helps.
Thanks, Chris Drozdowski Originlab Technical Support
|
 |
|
|
AKazak
Russia
1228 Posts |
Posted - 05/05/2020 : 08:56:13 AM
|
quote: Originally posted by Chris D
Hi,
The AS_NOHEIGHT flag tells Origin to not autosize the height of cells/rows. The AS_INVALIDATE flag tells Origin that it needs to redraw the columns at their new width. The | operator combines two or more flags.
So if you specified AS_NOHEIGHT | AS_INVALIDATE, you are telling Origin to both ignore resizing height and to force redraw.
I hope this helps.
Thanks, Chris Drozdowski Originlab Technical Support
OK. Does AS_NOWIDTH flag tell Origin to not autosize the width of cells/rows? What is the meaning of AS_SELECTION? |
 |
|
|
AKazak
Russia
1228 Posts |
Posted - 05/07/2020 : 12:00:23 PM
|
quote: Originally posted by AKazak OK. Does AS_NOWIDTH flag tell Origin to not autosize the width of cells/rows? What is the meaning of AS_SELECTION?
Any ideas? |
 |
|
|
cpyang
USA
1406 Posts |
Posted - 05/07/2020 : 12:29:03 PM
|
Yes, AS_NOWIDTH is to skip column width resizing.
AS_SELECTION should be to resize selected columns I supposed, I have not tried, must be -1 for column begin end to be effective.
CP
|
 |
|
|
AKazak
Russia
1228 Posts |
Posted - 05/08/2020 : 02:33:11 AM
|
quote: Originally posted by cpyang
Yes, AS_NOWIDTH is to skip column width resizing.
AS_SELECTION should be to resize selected columns I supposed, I have not tried, must be -1 for column begin end to be effective.
CP
OK. Please add this to the documentation.
Thank you. |
 |
|
| |
Topic  |
|
|
|