- Get_Property()
- Set_Property()
- Send_Message()
To maximize performance when dealing with properties it is common practice to pass @rm-delimited arrays to Get_Property and Set_Property like so:
0001 /*
0002 Example to illustrate accessing properties via @rm-delimited arrays.
0003
0004 i.e to replace code like this:
0005
0006 call set_Property( @window, "TEXT", "Customers" )
0007 call set_Property( @window, "TRACKINGSIZE", trkSize )
0008 call set_property( @window, "VISIBLE", TRUE$ )
0009
0010 ... and so on...
0011 */
0012
0013 objxArray = @window
0014 propArray = "TEXT"
0015 dataArray = "CUSTOMERS"
0016
0017 objxArray := @rm : @window
0018 proparray := @rm : "TRACKINGSIZE"
0019 dataArray := @rm : trkSize
0020
0021 objxArray := @rm : @window
0022 propArray := @rm : "VISIBLE"
0023 dataArray := @rm : TRUE$
0024
0025 call set_Property( objxArray, propArray, dataArray )
0026
0002 Example to illustrate accessing properties via @rm-delimited arrays.
0003
0004 i.e to replace code like this:
0005
0006 call set_Property( @window, "TEXT", "Customers" )
0007 call set_Property( @window, "TRACKINGSIZE", trkSize )
0008 call set_property( @window, "VISIBLE", TRUE$ )
0009
0010 ... and so on...
0011 */
0012
0013 objxArray = @window
0014 propArray = "TEXT"
0015 dataArray = "CUSTOMERS"
0016
0017 objxArray := @rm : @window
0018 proparray := @rm : "TRACKINGSIZE"
0019 dataArray := @rm : trkSize
0020
0021 objxArray := @rm : @window
0022 propArray := @rm : "VISIBLE"
0023 dataArray := @rm : TRUE$
0024
0025 call set_Property( objxArray, propArray, dataArray )
0026
A recent support query from one of our clients was to enquire if the Send_Message() function also supported a similar interface, and unfortunately the answer is no - it does not accept @rm-delimited arguments when invoked.
However the question did trigger a distant memory that led me to dig up a very old email thread from many years ago between ourselves and developers at Revelation, during which a similar capability was discussed and implemented, but alas, it appears, never documented.
Whilst Send_Message() itself doesn't support @rm-delimited arrays of message data, the Set_Property() function does support a "SEND_MESSAGE" property which can be used in a similar manner - you simply wrap the message name and arguments into an @fm-delimited array and use this as the new property value to set.
e.g.
0001 /*
0002 Example to illustrate calling messages via @rm-delimited
0003 arrays.
0004
0005 i.e to replace code like this:
0006
0007 call send_Message( @window, "COLOR_BY_POS", colPos, rowPos, cellColor )
0008 call send_Message( @window, "COLSTYLE", colPos, colStyle )
0009
0010 ... and so on...
0011 */
0012
0013 colPos = 3
0014 rowPos = 0
0015 cellColor = RED$ : @fm : WHITE$ : @fm : GREEN$ : @fm : YELLOW$
0016
0017 convert @fm to @vm in cellColor
0018
0019 objxArray = @window : ".TABLE_1"
0020 propArray = "SEND_MESSAGE"
0021 dataArray = "COLOR_BY_POS" : @fm : colPos : @fm : rowPos : |
0022 @fm : cellColor
0023
0024 objxArray := @rm : @window : ".TABLE_1"
0025 proparray := @rm : "SEND_MESSAGE"
0026 dataArray := @rm : "COLSTYLE" : @fm : colPos : @fm : colStyle
0027
0028 call set_Property( objxArray, propArray, dataArray )
0029
0002 Example to illustrate calling messages via @rm-delimited
0003 arrays.
0004
0005 i.e to replace code like this:
0006
0007 call send_Message( @window, "COLOR_BY_POS", colPos, rowPos, cellColor )
0008 call send_Message( @window, "COLSTYLE", colPos, colStyle )
0009
0010 ... and so on...
0011 */
0012
0013 colPos = 3
0014 rowPos = 0
0015 cellColor = RED$ : @fm : WHITE$ : @fm : GREEN$ : @fm : YELLOW$
0016
0017 convert @fm to @vm in cellColor
0018
0019 objxArray = @window : ".TABLE_1"
0020 propArray = "SEND_MESSAGE"
0021 dataArray = "COLOR_BY_POS" : @fm : colPos : @fm : rowPos : |
0022 @fm : cellColor
0023
0024 objxArray := @rm : @window : ".TABLE_1"
0025 proparray := @rm : "SEND_MESSAGE"
0026 dataArray := @rm : "COLSTYLE" : @fm : colPos : @fm : colStyle
0027
0028 call set_Property( objxArray, propArray, dataArray )
0029
Notice the convert statement in the code above - if you use any system delimiters in your message arguments (@fm,@vm,@svm,@tm) then you must convert them down a level, because the SEND_MESSAGE property will convert them up a level before executing the message internally.
In this way we can duplicate the stacking behaviour of Get and Set_Property for Send_Message.
No comments:
Post a Comment