...
- Open the Profound UI Visual Designer, start with a new display file and name the record format SFLCTL1.
- Add an exit button bound to an indicator named EXIT.
- Add two subfiles with output fields as shown below.
- Set the id of the first subfile to Grid1 and the second subfile to Grid2
- Set the record format name of the first subfile (Grid1) to SFLA and the second subfile (Grid2) to SFLB.
- The output fields in the 2 subfiles should be bound to FIELDA and FIELDB respectively. These fields are 20A.
- Bind an indicator named SFLCLR to the "clear subfile" property of both subfiles. (The same indicator can be used with both subfiles.)
- For both subfiles, set the properties as shown:
- Select the SFTCTL1 record format and bind the following fields to the properties shown:
- Save the display file as DRAGD and compile it to your library.
Compile the code below into your home library.
Code Block linenumbers true collapse true /DEFINE PROFOUNDUI H DFTACTGRP(*NO) * FDRAGD CF E WorkStn Handler('PROFOUNDUI(HANDLER)') F SFile(SFLA : RRNA) F SFILE(SFLB : RRNB) D RRNA S 5I 0 D RRNB S 5I 0 D ArrayA S 20A DIM(100) D CountA S 5I 0 D ArrayB S 20A DIM(100) D CountB S 5I 0 D RemoveItem PR D rm_ARRAY 20A DIM(100) D rm_Index 5I 0 CONST D InsertItem PR D in_ARRAY 20A DIM(100) D in_Index 5I 0 CONST D in_Value 20A CONST D in_Count 5I 0 D ClearEmpty PR D cl_ARRAY 20A DIM(100) D cl_Count 5I 0 D Item S 20A /FREE ArrayA(1) = 'Red'; ArrayA(2) = 'Green'; ArrayA(3) = 'Mouse'; ArrayA(4) = 'Dog'; ArrayA(5) = 'Kangaroo'; ArrayA(6) = 'Ant'; ArrayA(7) = 'Purple'; ArrayA(8) = 'White'; ArrayA(9) = 'Cat'; ArrayA(10) = 'Camel'; ArrayA(11) = 'Horse'; CountA = 11; ArrayB(1) = 'Orange'; ArrayB(2) = 'Gound Hog'; ArrayB(3) = 'Yellow'; ArrayB(4) = 'Black'; ArrayB(5) = 'Hog'; CountB = 5; Dou EXIT = *On; // Clear the subfiles. SFLCLR= *On; Write SFLCTL1; SFLCLR= *Off; // Load subfile A with Array A FOR RRNA = 1 TO CountA; FIELDA = ArrayA(RRNA); WRITE SFLA; ENDFOR; // Load subfile B with Array B FOR RRNB = 1 TO CountB; FIELDB = ArrayB(RRNB); WRITE SFLB; ENDFOR; // Display the subfile. ExFmt SFLCTL1; If EXIT = *Off; If DragFromId = 'Grid1' And DragToId = 'Grid1'; Chain DragFromRN SFLA; RemoveItem(ArrayA : DragFromRN); InsertItem(ArrayA : DragToRN : FIELDA : CountA); ENDIF; If DragFromId = 'Grid1' And DragToId = 'Grid2'; Chain DragFromRN SFLA; RemoveItem(ArrayA : DragFromRN); InsertItem(ArrayB : DragToRN : FIELDA : CountB); ENDIF; If DragFromId = 'Grid2' And DragToId = 'Grid2'; Chain DragFromRN SFLB; RemoveItem(ArrayB : DragFromRN); InsertItem(ArrayB : DragToRN : FIELDB : CountB); ENDIF; If DragFromId = 'Grid2' And DragToId = 'Grid1'; Chain DragFromRN SFLB; RemoveItem(ArrayB : DragFromRN); InsertItem(ArrayA : DragToRN : FIELDB : CountA); ENDIF; ClearEmpty(ArrayA : CountA); ClearEmpty(ArrayB : CountB); EndIf; // end if exit = off. EndDo; *InLr = *On; Return; /END-FREE P RemoveItem B D RemoveItem PI D rm_ARRAY 20A DIM(100) D rm_Index 5I 0 CONST /FREE rm_ARRAY(rm_Index) = 'EMPTYEMPTY'; return; /END-FREE P RemoveItem E P InsertItem B D InsertItem PI D in_ARRAY 20A DIM(100) D in_Index 5I 0 CONST D in_Value 20A CONST D in_Count 5I 0 D I s 5I 0 D Index s like(in_Index) /FREE Index = in_Index + 1; * Shift each element from the end of the array forward, starting from * the end and working backward to the destination index spot. for i = in_Count downto Index; in_ARRAY(i+1) = in_ARRAY(i); ENDFOR; * The destination spot gets the parameter value. in_ARRAY(Index) = in_Value; * Increment the size of the array (how many elements are filled). in_Count+=1; return; /END-FREE P InsertItem E P ClearEmpty B D ClearEmpty PI D cl_ARRAY 20A DIM(100) D cl_Count 5I 0 D lookIndex s 5I 0 D i s 5I 0 /FREE lookIndex = %lookup('EMPTYEMPTY':cl_ARRAY); if lookIndex > 0; for i = lookIndex to cl_Count; cl_ARRAY(i) = cl_ARRAY(i+1); ENDFOR; cl_Count-=1; ENDIF; return; /END-FREE P ClearEmpty E
Properties
Allow Drag
...