SHIFT+MOUSE Click Multiple selection

Author: palakarthik1@gmail.com (palakarthik1)

Hello All,        Could some one please let me know how to implement SHIFT+MOUSE Click multiple selections in Uniface Grid. Thanks alot. Karthik

5 Comments

  1. In the extended triggers of the grid widget, you need to do something like this, where srvid.<$entname> is the primary kley of the occurrence.    trigger RowHeader_LClicked params numeric rowNumber : in numeric shiftKey : in endparams variables boolean v_started, v_switch numeric v_first, v_last endvariables if(shiftkey=0) forentity "<$entname>" if( rowNumber= $curocc($entname) ) putitem/id $srvselected$,srvid.<$entname>,"T" else delitem/id $srvselected$,srvid.<$entname> endif endfor elseif (shiftkey= 2);Ctrl select setocc "<$entname>",rowNumber if($item(srvid.<$entname>,$srvselected$) != "") delitem/id $srvselected$,srvid.<$entname> else putitem/id $srvselected$,srvid.<$entname>,"T" endif $lastserver$ = srvid.<$entname> elseif (shiftkey=1) ;Shift select setocc "<$entname>",rowNumber putitem/id $srvselected$,srvid.<$entname>,"T" v_last= $itemnr(2,$srvselected$) if ($status> 0) v_first= $itemnr(1,$srvselected$); this gets the server id forentity "<$entname>" if (v_first= srvid.<$entname> ) v_first= $curocc($entname) break endif endfor ; v_first= $item(srvid.<$entname>,$srvselected$); this gets the row number v_last = rowNumber if (v_first > v_last) v_last= v_first v_first= rowNumber endif else return(-1) endif ; forentity "<$entname>" ; ;if($item(srvid.<$entname>,$srvselected$) != "") ; ; delitem/id $srvselected$,srvid.<$entname>; if not selected do nothing ; if ((v_first= "" | v_first=0) & ($item(srvid.<$entname>,$srvselected$) = "T")) ; v_first= $curocc($entname) ; elseif (v_first > 0 & ($item(srvid.<$entname>,$srvselected$) = "T")) ; v_last= $curocc($entname) ; endif ; endfor ; forentity "<$entname>" if( v_first<= $curocc($entname) & v_last >= $curocc($entname) ) putitem/id $srvselected$,srvid.<$entname>,"T" else putitem/id $srvselected$,srvid.<$entname>,"" endif endfor else v_started = <false> forentity "<$entname>" if(v_started) ; In flagging loop if(srvid.<$entname> = $lastserver$ | $curocc("<$entname>") = rowNumber) if(v_switch) putitem/id $srvselected$,srvid.<$entname>,"T" else delitem/id $srvselected$,srvid.<$entname> endif break ; No need to go further else if(v_switch) putitem/id $srvselected$,srvid.<$entname>,"T" else delitem/id $srvselected$,srvid.<$entname> endif endif else if(srvid.<$entname> = $lastserver$) ; Found first in line, take v_switch v_switch = $item(srvid.<$entname>,$srvselected$) elseif($curocc("<$entname>") = rowNumber) ; Found last in line, v_switch = change_state v_switch = !$item(srvid.<$entname>,$srvselected$) if(v_switch) putitem/id $srvselected$,srvid.<$entname>,"T" else delitem/id $srvselected$,srvid.<$entname> endif endif endif endfor endif setocc "<$entname>",rowNumber


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. FiresongKt is right. You need the Extended Triggers of the Grid. All other trigger can't see if they were fired by a keyboard action or by a mouse action. And therefore they also cannot distinguish if the mouse was clicked with shift/ctrl/alt. So, if you want multi-select you need to show row headers. Theo


    Author: Theo Neeskens (tneeskens@itblockz.nl)
  3. I don't know of any other trigger which catches the SHIFT/CTRL key status when they are pressed. The only other trigger available for mouse options is the field gets focus trigger, and I don't know that that can even tell you if you moused to the field, or tabbed there. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  4. Hi, On the Samples page http://unifaceinfo.com/samples/ you can find the GUI Sample: GRID (not HTML GRID that is for other purposes). It will give you sample code that you can see in action so that might be easier to get started. Theo


    Author: Theo Neeskens (tneeskens@itblockz.nl)
  5. Thanks alot Theo and Firesongkt. The above solution works if we go with Clicking on RowHeader which is displayed for every row. But In realtime scenarios, If user doesnt want this row header to be displayed, Is there any alternative solution in order to implement this? Thanks in advance.


    Author: palakarthik1 (palakarthik1@gmail.com)