I am using hiCreateReportField and choosing the argument ?callback to find out which row
has been selected. The callback (as shown in the documentation for hiCreateReportField)
function is automatically passed two arguments. The first argument is the field name, the
second argument is a list of integers representing the selected items in the report.
My question is... How can I pass additional variables to my callback function while
keeping the two arguments passed automatically (fieldName selectedItems)?
reportField = hiCreateReportField(
? callback 'reportCB
procedure( reportCB(fieldName selectedItems "sl") printf( "Report field callback, fieldName = %L, selectedItems = %L" fieldName selectedItems ))
There is a way using SKILL++ lexical scoping (using closures) to achieve this (in effect) - I describe a similar problem for ipcBeginProcess in this solution.
However, in this case, I'm not sure where this additional argument is coming from - how would the report field callback know where to get it from? It might just be simpler to make the callback a string and then within the callback call hiReportGetSelectedItems().
This would never work:
because the variable with the form is quoted and so not evaluated. Similarly:
if the form is currently having a string field. However, if your code has switched across to replacing the field with a report field, then it would work fine.
See the example below. If you run the code (using the line in the comment on the first line) and then go to the third tab. Click on Print Selections and it will show a message in the CIW saying it's a string field. If you click on the Add Field button first, then click on Print Selections you'll see info about whatever is selected.
; call hiDisplayForm(abCreateTabForm()) to see the example
let((tabField addField1 addField2 addField3 printSelections tabInfo1
?buttonText "Do nothing"
?buttonText "Do nothing"
?buttonText "Add Field"
?buttonText "Print Selections"
list(addField1 100:0 200:30)
list(tabInfo1 0:30 540:30 100)
list(addField2 100:0 200:30)
list(tabInfo2 0:30 540:30 100)
list(addField3 100:0 200:30)
list(printSelections 320:0 200:30)
list(tabInfo3 0:30 540:30 100)
?tabs list("First" "Second" "Third")
?formTitle "Tab Form"
list(tabField 0:0 800:400 30)
let((title_str (error_lay_hilo_number 3) (error_lay_hilo
list("albert" "metal1" "drawing" "high" 1.0 2.0)
list("george" "metal2" "drawing" "low" 3.0 1.0)
list("harry" "metal3" "drawing" "low" -3.0 5.0)
sprintf(title_str "Layout Hierarchical Check Report - %d errors" error_lay_hilo_number)
list("Layout cell name" 300 'left 'string t)
list("Layer" 40 'left 'string)
list("Purpose" 60 'left 'string)
list("Voltage" 60 'left 'string)
list(" X-coord" 80 'right 'float)
list(" Y-coods" 80 'right 'float)
50:60 700:400 30)
printf("SELECTIONS ARE: %L\n"
; I'd probably use -> rather than ~> but it doesn't matter
printf("FIELD IS CURRENTLY A STRING FIELD\n")
Sorry for the late reply. Thank you that is indeed what I need.
As usual it was my code. I loaded it into IDE set a few break points
and saw what I was doing wrong.
Thanks again for taking the time to educate... its really appreciated.
Whenever user press column header in report filed we need to callback function for that.
How to implement that logic.