Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Programatic OI9 EditTable property change

I have set individual columns in a OI Table (not the whole table) to be protected by default in the Form Designer . No problem.
I am having a mental blank now as to how to change that property in code when certain conditions are met. :(

Comments

  • $Insert ColStyle_Equates *************** Set_The_Style: *************** OrigStyle = Send_Message(CtrlEntId, "COLSTYLE", 0, '') styles = OrigStyle For i = 1 To TotalColumns ColumnNo = ColumnList<i> styles<ColumnNo> = bitor(styles<ColumnNo>, StyleType) Next i OrigStyle = Send_Message(CtrlEntId, "COLSTYLE", 0, styles) Return

    where StyleType is one of the equates from the insert, in your case ProtectStyle$
  • Just realised, I'm not sure where I got the colstyle equates insert from. I was assuming it was a part of sysprog but it aint. Sorry about that.

    You could insert rti_style_equates instead and then use the "EditTable Column Styles" equates prefixed with "DTCS_"

    In that case it would be DTCS_PROTECT$
  • @AusMarkB
    Thanks for that. Yeah I got that far on the insert before I read your last update ;-)

    Your original post triggered my memory and it lead me to re-read the SRP wiki info on the various STYLE/COLSTYLE/STYLE BY POS and Bit-wise operators!

    What I needed was a simple:
    ColStyle = Send_Message(CtrlEntId, "STYLE_BY_POS", 1) ColStyle = bitand(ColStyle, bitnot(DTCS_PROTECT$)) ColStyle = Send_Message(CtrlEntId, "STYLE_BY_POS", 1, 0, ColStyle)
    to alter just the first column.

    I have something curious but I am not sure I want to go down the rabbit hole since this code works but if someone has a quick explanation....
    My orignal style value is 265.
    The original style value if I just unprotect that column via the form designer is 261 (this obviously works so this is the value I had been aiming for in my testing when trying to do it programatically)
    However, the Style value when I apply the above code (that works) is 257.
    Based on the fact DTCS_PROTECT$ = 8 I did actually expected the 257!

    261 or 257?
    The only thing that makes sense is the 'Protected' checkbox on the column in the Form Designer actualy does the equivalent of a DTCS_EDIT$ (which is the 4).

Sign In or Register to comment.