Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 27 SEP 2023 10:38:36PM Matthew Crozier wrote:

In v10 we try not to use style bits and expose properties instead

What is the best way to determine how v9 style bits can be translated to v10 property equivalents?

It appears that there isn't a direct translation for these, especially where the edittables behave differently or have different features.

For example, in v9 ticking the 'Protected' property of an edittable will prevent rows from being inserted or deleted, and cells from being edited. If I'm not wrong, this is controlled just by the DTS_EDIT SDKstyle bit alone.

The v10 property equivalents for this are a combination of the @etCtrl→AllowRowInsert, @etCtrl→AllowRowDelete, and @etCtrl.CELLS{0,0}→EditMode properties together.

I presume v10 must be doing similar logic to support backward compatibility for the v9 STYLE properties.

Cheers, M@

Vernon Systems


At 28 SEP 2023 06:44AM Carl Pates wrote:

Hi M@,

Here's the v9 style→v10 property mapping for "core" styles:

   DTS_VIRTUALMEM                          -> <not used in v9>

   DTS_EDIT                                -> AllowRowDelete, AllowRowInsert

   DTS_RESIZE                              -> <not used in v9>

   DTS_OWNERDEF (DTS_NUMBERS|DTS_LETTERS)  -> ShowColumnHeaders

   DTS_HGRID                               -> GridStyle

   DTS_VGRID                               -> GridStyle

   DTS_ROWSELECT                           -> RowSelectMode (Single)

   DTS_MULTIROW                            -> RowSelectMode (Multi)

   DTS_COLSELECT                           -> ColSelectMode (Single)

   DTS_MULTICOL                            -> ColSelectMode (Multi)

   DTS_SCROLLNOHIDE                        -> ScrollBarsAlways

   DTS_ROWBUTTONS                          -> ShowRowButtons

   DTS_ROWNUMBERS                          -> ShowRowNumbers 

   DTS_DROPDOWN                            -> <not used in v9>

   

   WS_BORDER                               -> EdgeStyle (Sunken)

   WS_HSCROLL                              -> ScrollBars

   WS_VSCROLL                              -> ScrollBars

And here is the mapping for column styles:

   DTCS_RESIZE                             -> Resizable

   DTCS_FIXED                              -> <not used in v9>

   DTCS_EDIT                               -> EditMode (Enabled)

   DTCS_PROTECT                            -> EditMode (Protected)

   DTCS_UPPERCASE                          -> TextCase( (Upper)

   DTCS_HIDDEN                             -> Visible 

   DTCS_CENTER                             -> TextAlign

   DTCS_RIGHT                              -> TextAlign

   DTCS_HEADCENTER                         -> Header.TextAlign

   DTCS_HEADRIGHT                          -> Header.TextAlign

   DTCS_VSCROLL                            -> ScrollBars 

   DTCS_HSCROLL                            -> ScrollBars 

   DTCS_SKIPPED                            -> Skipped

   DTCS_LOCKED                             -> <not used in v9> 

   DTCS_SORTASC                            -> <not used in v9>

   DTCS_SORTDES                            -> <not used in v9>

   DTCS_CHECKBOX                           -> CellType (CheckBox)

   DTCS_DROPDOWN                           -> CellType (DropDownList)

   DTCS_HEADMULTI                          -> Header.MultiLine

   DTCS_CHKRIGHT                           -> CheckBoxAlign

   DTCS_VALIGNTOP                          -> TextAlign

   DTCS_VALIGNCENTER                       -> TextAlign

   DTCS_VALIGNBOTTOM                       -> TextAlign

   DTCS_DROPDOWNEDIT                       -> CellType (DropDownEdit)

   DTCS_OPTIONSBUTTON                      -> OptionsButton

   DTCS_ENABLEDROPDOWNDRAG                 -> <not supported in v10>

   DTCS_MULTILINE                          -> MultiLine

   DTCS_AUTOVSCROLL                        -> AutoScroll

   DTCS_AUTOHSCROLL                        -> WordWrap

   DTCS_ENABLEDRAG                         -> <in process>

   DTCS_ENABLEDROP                         -> <in process>

   DTCS_CHKCENTER                          -> CheckBoxAlign

Regards

Carl Pates


At 28 SEP 2023 03:59PM Matthew Crozier wrote:

Here's the v9 style→v10 property mapping for "core" styles:

Ah, lovely - thanks Carl!

Cheers, M@

Vernon Systems


At 28 SEP 2023 09:05PM Matthew Crozier wrote:

I'm also trying to work out which properties are available in the EditTable Sub-Object Interface.

In particular, can you implement COLOR_BY_POS using this interface? It seems a COLOR property is not available at any object level. It looks like color settings are incorporated into the CELLSTYLES property, but this seems to only be available for CONTROL and COLUMNS objects, but not CELLS.

Granted, COLOR information is more complex than TEXT or FONT - especially in OI10. Is it best still to use COLOR_BY_POS as an Exec_Method?

Cheers, M@

Vernon Systems


At 28 SEP 2023 09:25PM Barry Stevens wrote:

I'm also trying to work out which properties are available in the EditTable Sub-Object Interface.

In particular, can you implement COLOR_BY_POS using this interface? It seems a COLOR property is not available at any object level. It looks like color settings are incorporated into the CELLSTYLES property, but this seems to only be available for CONTROL and COLUMNS objects, but not CELLS.

Granted, COLOR information is more complex than TEXT or FONT - especially in OI10. Is it best still to use COLOR_BY_POS as an Exec_Method?

Cheers, M@

Vernon Systems

Did you look at the docs here


At 28 SEP 2023 09:36PM Matthew Crozier wrote:

Did you look at the docs here

Yes, I looked in those docs but couldn't find anything specific to this. (I did learn some new stuff though ;) )

Cheers, M@

Vernon Systems


At 28 SEP 2023 10:10PM Barry Stevens wrote:

Did you look at the docs here

Yes, I looked in those docs but couldn't find anything specific to this. (I did learn some new stuff though ;) )

Cheers, M@

Vernon Systems

Went looking in my KB and found this.

Does this point you in a direction?

So to set the header text for column 1 to Red you would do something like this:



```

   cs = ""

   cs<PS_EDT_CS_POS_FORECOLOR$> = RED$

   bHdr = TRUE$

   call exec_Method( WeekTable$ : ".COLUMNS", "CELLSTYLE", 1, PS_EDT_CS_NORMAL$, bHdr, cs )

```

At 29 SEP 2023 05:06AM Andrew McAuley wrote:

Here's a snippet from one of our systems using SET_PROPERTY

      objxArray := @Rm : atWindow : ".EDT_REQUIRED_DOCUMENTS" 

      propArray := @Rm : "LIST" 

      dataArray := @Rm : retVal

   

      objxArray := @Rm : atWindow : ".EDT_REQUIRED_DOCUMENTS.CELLS"

      propArray := @Rm : "EXECMETHOD"

      dataArray := @Rm : "CELLSTYLE" : @Fm : 2 : @Fm : 0 : @Fm : PS_EDT_CS_NORMAL$ : @Fm : 0 : @Fm : red$

      

The Sprezzatura Group

The Sprezzatura Blog

World leaders in all things RevSoft


At 01 OCT 2023 09:38PM Matthew Crozier wrote:

Ok, thanks! - this is getting more and more curious ;)

objxArray := @Rm : atWindow : ".EDT_REQUIRED_DOCUMENTS.CELLS"

propArray := @Rm : "EXECMETHOD"

dataArray := @Rm : "CELLSTYLE" : @Fm : 2 : @Fm : 0 : @Fm : PS_EDT_CS_NORMAL$ : @Fm : 0 : @Fm : red$[/code</QUOTE>


<QUOTE>
<code>
cs<PS_EDT_CS_POS_FORECOLOR$> = RED$

bHdr = TRUE$

call exec_Method( WeekTable$ : ".COLUMNS", "CELLSTYLE", 1, PS_EDT_CS_NORMAL$, bHdr, cs )

So my understanding is - as well as the CELLSTYLES (plural) Property, which has the PS_EDT_CS structure as in PS_EDITTABLE_EQUATES, there is also a CELLSTYLE (singular) Method, whose arguments are ( colIdx, [rowIdx,] CellType, bHdr, struct_PS_EDT_CS_POS ).

I presume all the Properties available to the edittable sub-objects are those shown in the Columns window in Form Designer.

What Methods are available to the edittable sub-objects?

Cheers, M@

Vernon Systems


At 02 OCT 2023 04:51AM Carl Pates wrote:

Hi M@,

I'm putting together some notes for you on this so please bear with me, but briefly the CELLSTYLES property sets the defaults for column headers, row headers and data cells. The CELLSTYLE method allows you to make changes to individual elements at runtime.

More info soon …

Cheers

Carl Pates


At 02 OCT 2023 04:26PM Matthew Crozier wrote:

the CELLSTYLES property sets the defaults for column headers, row headers and data cells. The CELLSTYLE method allows you to make changes to individual elements at runtime.

Ah, that makes sense.

It sounds like your putting another article together :) . I'd be interested to know if the CELLSTYLE method can return the current state of cell(s) without modification.

Cheers, M@

Vernon Systems


At 04 OCT 2023 11:22AM Carl Pates wrote:

Hi M@,

(All info applies to 10.2.1 Beta 4+)

A "CellStyle" is an array of visual styling information that is applied to a specific state that a column, row or cell is in. The possible states and the fields for the array itself are defined in PS_EDITTABLE_EQUATES:

   // CELLSTYLE equates

   //

   // A column, row or cell can have a style applied to it that is used for

   // a specific state (this applies to header cells as well)

   // 

   // The states that can have a style applied are:

   //

   //    Normal

   //    Hot

   //    Disabled

   //    Selected

   //    HotSelected

   //    SelectedNoFocus

   //    Current

   

   equ PS_EDT_CS_NORMAL$                         to 0

   equ PS_EDT_CS_HOT$                            to 1

   equ PS_EDT_CS_DISABLED$                       to 2

   equ PS_EDT_CS_SELECTED$                       to 3

   equ PS_EDT_CS_HOTSELECTED$                    to 4

   equ PS_EDT_CS_SELNOFOCUS$                     to 5

   equ PS_EDT_CS_CURRENT$                        to 6

   

   // The styling that can be applied for a state is defined by the 

   // following structure:

   // 

   // <1> ForeColor                 (COLORREF)

   // <2> BackColor From            (COLORREF)

   // <3> BackColor To              (COLORREF)

   // <4> Bold                      TRUE$/FALSE$

   // <5> Italic                    TRUE$/FALSE$

   // <6> Underline                 TRUE$/FALSE$

   // <7> Translucency              (0-100) 

   // <8> GlyphIndex                (>=0)

   

   equ PS_EDT_CS_POS_FORECOLOR$                  to 1

   equ PS_EDT_CS_POS_BACKCOLORFROM$              to 2

   equ PS_EDT_CS_POS_BACKCOLORTO$                to 3

   equ PS_EDT_CS_POS_BOLD$                       to 4

   equ PS_EDT_CS_POS_ITALIC$                     to 5

   equ PS_EDT_CS_POS_UNDERLINE$                  to 6

   equ PS_EDT_CS_POS_TRANSLUCENCY$               to 7

   equ PS_EDT_CS_POS_GLYPHINDEX$                 to 8

An EditTable has COLUMNS, ROWS and CELLS sub-objects. You can use Exec_Method with any of these to set a CELLSTYLE. CELLS overrides ROWS which overrides COLUMNS.

   currStyle = exec_Method( ctrlEntID : ".COLUMNS", "CELLSTYLE", colNo, stateID, bHeader )

   prevStyle = exec_Method( ctrlEntID : ".COLUMNS", "CELLSTYLE", colNo, stateID, bHeader, newStyle )

   

   currStyle = exec_Method( ctrlEntID : ".ROWS", "CELLSTYLE", rowNo, stateID, bHeader )

   prevStyle = exec_Method( ctrlEntID : ".ROWS", "CELLSTYLE", rowNo, stateID, bHeader, newStyle )

   

   currStyle = exec_Method( ctrlEntID : ".CELLS", "CELLSTYLE", colNo, rowNo, stateID )

   prevStyle = exec_Method( ctrlEntID : ".CELLS", "CELLSTYLE", colNo, rowNo, stateID, newStyle )

The COLUMNS and ROWS and rows sub-objects are fairly simple - you specify the index of the col/row you want, the state that you want to affect, and if you want to set the style for the header cell or the data cells in the col/row.

The CELLS API is a little more complex because you can use it to affect the style of any of the following:[list]The default data cell (affects all data cells)

The default column header(affects all col header cells)

The default row header (affects all row header cells)

The top-left header corner cell

A specific column header (a la the COLUMNS object)

A specific column data cells (a l. the COLUMNS object)

A specific row header (a la the ROWS object)

A specific row data cells (a la the ROWS object)

A specific data cell[/list]

This is implemented by how you set the colNo and rowNo parameters and is summarized in the following table:

                                    COLUMNS



                  ||   <null>    |      0      |     n

         =========||========================================

          <null>  ||  <defcell>  | <defcolhdr> | <coldata>

         ---------||-------------|-------------|------------

 ROWS        0    || <defrowhdr> |  <corner>   | <colhdr>

         ---------||-------------|-------------|------------

             n    ||  <rowdata>  |  <rowhdr>   | <celldata>

i.e.

   ( colNo == ""  and rowNo == ""  ) - affects the default data cell

   ( colNo == "0" and rowNo == "0" ) - affects the corner cell

   ( colNo == "0" and rowNo == ""  ) - affects the default column header

   ( colNo == ""  and rowNo == "0" ) - affects the default row header

   ( colNo >  "0" and rowNo == "0" ) - affects the specified column header 

   ( colNo >  "0" and rowNo == ""  ) - affects the specified column data cells 

   ( colNo == "0" and rowNo >  "0" ) - affects the specified row header

   ( colNo == ""  and rowNo >  "0" ) - affects the specified row data cells

   ( colNo >  "0" and rowNo >  "0" ) - affects the specified data cell

Cheers

Carl Pates


At 04 OCT 2023 04:33PM Matthew Crozier wrote:

Nice! - thanks Carl :)

Also corrects a few of my wrong assumptions ;)

Great that we can get current state - particularly useful when wanting to reset a cell's style back to the style of its row, etc. I'm maintaining a similar array in OI9 to keep track of COLOR_BY_POS settings.

Cheers, M@

Vernon Systems

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/5af988757b0bd54aa14fae1197d0b586.txt
  • Last modified: 2024/12/10 16:16
  • by 127.0.0.1