FocusPolicy queries

I have following queries regarding Focus policy:

1. In editor for a node, for a cell i set attracts focus= attractsfocus (without condition)
    a) Now i add that node using ctrl+space menu. Works fine!
    b) If i add same node using Intentions Focus policy used in editor not works. Why so?
           I am adding new node in Intentions using add new intitialized().

2. As focus policy set in editor not works for Intentions for me.
    can i set the focus to a cell for a node from Intentions?
    Like using selectWRTFocusPolicy(Don't know how to use it actually)

3. Currently, attractsfocus policy for a cell defined in editor works only when the new node is created. Can i shift the focus  from one cell to other based on condition even after adding the node during execution.
4 comments
Hey, now options 1 & 2 are now working for me.
Used selectWRTFocusPolicy in Intentions to set focus and focus policy added in Editor works fine :)

Now left only with 3rd query.
0
I'm not sure I understand correctly when you want to set focus, but have you tried the node.select[...] syntax (SelectInEditorOperation concept from j.m.lang.editor)?
0
Answering to your e-mail:
"
My requirement is-
My editor is like:
from_cell       MAPS_Constant     to_cell
when from_cell get populated using ctrl+space by default focus is in the cell from_cell only but i want it get shifted to to_cell.
"

I suggest that you explicitly define the items in the completion menu on the first cell, which gives you the option to define the cell selection explicitly. You need to fill in the "menu" definition for the first cell:

menu parts:      
generic group    
   parameter object type : string              
   parameter objects : (operationContext, node)->list<string> { 
  list<string> result = new arraylist<string>; 
  list<enummember<from>> members = enum/from/.members; 
  members.forEach({~member => result.add(member.value); }); 
  result; 
}
   presentation : default       
   handler : (parameterObject, node, model, editorContext, operationContext)->void { 
  node.from = parameterObject; 
  node.select[in: editorContext, cell: LAST_EDITABLE]; 
}       
prettyPrint();
0
Thanks, its working fine.
It solve many other problems also.
0

Please sign in to leave a comment.