1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
3 &Scoped-define WINDOW-NAME CURRENT-WINDOW
4 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
5 /*------------------------------------------------------------------------
7 ------------------------------------------------------------------------*/
11 /* *************************** Definitions
************************** */
13 DEF WORK-TABLE MenuNode
NO-UNDO
14 FIELD NodeCode
LIKE LinkNode.NodeCode
15 FIELD Description
LIKE LinkNode.Description.
17 DEF WORK-TABLE ItemNode
NO-UNDO
18 FIELD ButtonLabel
LIKE ProgramLink.ButtonLabel
19 FIELD LinkCode
LIKE ProgramLink.LinkCode
20 FIELD ItemStatus
AS CHAR.
22 DEF VAR menu-altered
AS LOGI
NO-UNDO.
23 DEF VAR last-id
AS ROWID NO-UNDO.
24 DEF VAR this-win
AS HANDLE NO-UNDO.
26 /* _UIB-CODE-BLOCK-END
*/
30 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
32 /* ******************** Preprocessor Definitions
******************** */
34 &Scoped-define PROCEDURE-TYPE SmartViewer
36 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
38 /* Name of first Frame and
/or Browse and
/or first Query
*/
39 &Scoped-define FRAME-NAME F-Main
41 /* Standard List Definitions
*/
42 &Scoped-Define ENABLED-OBJECTS tgl_topmost sel_mavail btn_madd sel_mcurr ~
43 btn_mrem sel_iavail btn_save sel_icurr btn_iadd btn_irem btn_iup btn_idown
44 &Scoped-Define DISPLAYED-OBJECTS tgl_topmost sel_mavail sel_mcurr ~
47 /* Custom List Definitions
*/
48 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
50 /* _UIB-PREPROCESSOR-BLOCK-END
*/
54 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" V-table-Win _INLINE
55 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
61 GroupName|y|y|TTPL.UsrGroup.GroupName
64 **************************
65 * Set attributes related to FOREIGN
KEYS
67 RUN set-attribute-list
(
68 'Keys-Accepted
= "GroupName",
69 Keys-Supplied
= "GroupName"'
:U
).
70 /**************************
72 /* _UIB-CODE-BLOCK-END
*/
76 /* *********************** Control Definitions
********************** */
79 /* Menu Definitions
*/
80 DEFINE MENU POPUP-MENU-sel_iavail
81 MENU-ITEM m_AvailEdit
LABEL "Edit Link" .
83 DEFINE MENU POPUP-MENU-sel_icurr
84 MENU-ITEM m_Edit
LABEL "&Edit Link"
85 MENU-ITEM m_Edit_i-Target
LABEL "Edit &Target"
86 MENU-ITEM m_Change_i-Group
LABEL "Change &Group" .
88 DEFINE MENU POPUP-MENU-sel_mcurr
89 MENU-ITEM m_Edit_m-node
LABEL "&Edit node"
90 MENU-ITEM m_Change_m-Group
LABEL "Change &Group" .
93 /* Definitions of the field level widgets
*/
94 DEFINE BUTTON btn_iadd
99 DEFINE BUTTON btn_idown
104 DEFINE BUTTON btn_irem
109 DEFINE BUTTON btn_iup
114 DEFINE BUTTON btn_madd
119 DEFINE BUTTON btn_mrem
124 DEFINE BUTTON btn_save
129 DEFINE VARIABLE sel_iavail
AS CHARACTER
130 VIEW-AS SELECTION-LIST MULTIPLE SORT SCROLLBAR-VERTICAL
134 DEFINE VARIABLE sel_icurr
AS CHARACTER
135 VIEW-AS SELECTION-LIST MULTIPLE SCROLLBAR-VERTICAL
139 DEFINE VARIABLE sel_mavail
AS CHARACTER
140 VIEW-AS SELECTION-LIST SINGLE SORT SCROLLBAR-VERTICAL
144 DEFINE VARIABLE sel_mcurr
AS CHARACTER
145 VIEW-AS SELECTION-LIST SINGLE SORT SCROLLBAR-VERTICAL
149 DEFINE VARIABLE tgl_topmost
AS LOGICAL INITIAL no
156 /* ************************ Frame Definitions
*********************** */
159 tgl_topmost
AT ROW 1 COL 65
160 sel_mavail
AT ROW 2 COL 2 NO-LABEL
161 btn_madd
AT ROW 2 COL 33
162 sel_mcurr
AT ROW 2 COL 45 NO-LABEL
163 btn_mrem
AT ROW 3.2 COL 33
164 sel_iavail
AT ROW 11.5 COL 2 NO-LABEL
165 btn_save
AT ROW 11.5 COL 33
166 sel_icurr
AT ROW 11.5 COL 45 NO-LABEL
167 btn_iadd
AT ROW 16 COL 33
168 btn_irem
AT ROW 17.2 COL 33
169 btn_iup
AT ROW 20.5 COL 33
170 btn_idown
AT ROW 21.7 COL 33
171 "Current Items" VIEW-AS TEXT
172 SIZE 10 BY 1 AT ROW 10.5 COL 45
174 "Available Items" VIEW-AS TEXT
175 SIZE 11 BY 1 AT ROW 10.5 COL 2
177 "Current Menus" VIEW-AS TEXT
178 SIZE 13.72 BY 1 AT ROW 1 COL 45
180 "Available Menus" VIEW-AS TEXT
181 SIZE 16 BY 1 AT ROW 1 COL 2
183 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
184 SIDE-LABELS NO-UNDERLINE THREE-D
185 AT COL 1 ROW 1 SCROLLABLE .
188 /* *********************** Procedure Settings
************************ */
190 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
191 /* Settings for
THIS-PROCEDURE
193 Allow
: Basic
,DB-Fields
195 Add Fields to
: EXTERNAL-TABLES
196 Other Settings
: PERSISTENT-ONLY
COMPILE
199 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
200 /* then cleanup and return.
*/
201 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
202 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
203 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
207 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
209 /* ************************* Create Window
************************** */
211 &ANALYZE-SUSPEND _CREATE-WINDOW
212 /* DESIGN Window definition
(used by the UIB
)
213 CREATE WINDOW V-table-Win
ASSIGN
216 /* END WINDOW DEFINITION
*/
221 /* *************** Runtime Attributes and UIB Settings
************** */
223 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
224 /* SETTINGS
FOR WINDOW V-table-Win
225 VISIBLE,,RUN-PERSISTENT
*/
226 /* SETTINGS
FOR FRAME F-Main
227 NOT-VISIBLE Size-to-Fit
*/
229 FRAME F-Main
:SCROLLABLE = FALSE
230 FRAME F-Main
:HIDDEN = TRUE.
233 sel_iavail
:POPUP-MENU IN FRAME F-Main
= MENU POPUP-MENU-sel_iavail
:HANDLE.
236 sel_icurr
:POPUP-MENU IN FRAME F-Main
= MENU POPUP-MENU-sel_icurr
:HANDLE.
239 sel_mcurr
:POPUP-MENU IN FRAME F-Main
= MENU POPUP-MENU-sel_mcurr
:HANDLE.
241 /* _RUN-TIME-ATTRIBUTES-END
*/
245 /* Setting information for Queries and Browse Widgets fields
*/
247 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
248 /* Query rebuild information for
FRAME F-Main
251 */ /* FRAME F-Main
*/
257 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
258 /* ************************* Included-Libraries
*********************** */
260 {src
/adm
/method
/viewer.i
}
261 {inc
/method
/m-mntvwr.i
}
263 /* _UIB-CODE-BLOCK-END
*/
269 /* ************************ Control Triggers
************************ */
271 &Scoped-define SELF-NAME btn_iadd
272 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_iadd V-table-Win
273 ON CHOOSE OF btn_iadd
IN FRAME F-Main
/* Add
*/
278 /* _UIB-CODE-BLOCK-END
*/
282 &Scoped-define SELF-NAME btn_idown
283 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_idown V-table-Win
284 ON CHOOSE OF btn_idown
IN FRAME F-Main
/* Move Down
*/
289 /* _UIB-CODE-BLOCK-END
*/
293 &Scoped-define SELF-NAME btn_irem
294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_irem V-table-Win
295 ON CHOOSE OF btn_irem
IN FRAME F-Main
/* Remove
*/
300 /* _UIB-CODE-BLOCK-END
*/
304 &Scoped-define SELF-NAME btn_iup
305 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_iup V-table-Win
306 ON CHOOSE OF btn_iup
IN FRAME F-Main
/* Move Up
*/
311 /* _UIB-CODE-BLOCK-END
*/
315 &Scoped-define SELF-NAME btn_madd
316 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_madd V-table-Win
317 ON CHOOSE OF btn_madd
IN FRAME F-Main
/* Add
*/
322 /* _UIB-CODE-BLOCK-END
*/
326 &Scoped-define SELF-NAME btn_mrem
327 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_mrem V-table-Win
328 ON CHOOSE OF btn_mrem
IN FRAME F-Main
/* Remove
*/
333 /* _UIB-CODE-BLOCK-END
*/
337 &Scoped-define SELF-NAME btn_save
338 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_save V-table-Win
339 ON CHOOSE OF btn_save
IN FRAME F-Main
/* Save
*/
344 /* _UIB-CODE-BLOCK-END
*/
348 &Scoped-define SELF-NAME m_AvailEdit
349 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_AvailEdit V-table-Win
350 ON CHOOSE OF MENU-ITEM m_AvailEdit
/* Edit Link
*/
352 DO WITH FRAME {&FRAME-NAME}:
353 FIND FIRST ItemNode
WHERE ItemNode.ButtonLabel
= INPUT sel_iavail.
354 RUN edit-link-dialog
( ItemNode.LinkCode
).
358 /* _UIB-CODE-BLOCK-END
*/
362 &Scoped-define SELF-NAME m_Change_i-Group
363 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Change_i-Group V-table-Win
364 ON CHOOSE OF MENU-ITEM m_Change_i-Group
/* Change Group
*/
366 RUN item-group-dialog.
369 /* _UIB-CODE-BLOCK-END
*/
373 &Scoped-define SELF-NAME m_Change_m-Group
374 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Change_m-Group V-table-Win
375 ON CHOOSE OF MENU-ITEM m_Change_m-Group
/* Change Group
*/
377 RUN menu-group-dialog.
380 /* _UIB-CODE-BLOCK-END
*/
384 &Scoped-define SELF-NAME m_Edit
385 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Edit V-table-Win
386 ON CHOOSE OF MENU-ITEM m_Edit
/* Edit Link
*/
388 DO WITH FRAME {&FRAME-NAME}:
389 FIND FIRST ItemNode
WHERE ItemNode.ButtonLabel
= INPUT sel_icurr.
390 RUN edit-link-dialog
( ItemNode.LinkCode
).
394 /* _UIB-CODE-BLOCK-END
*/
398 &Scoped-define SELF-NAME m_Edit_i-Target
399 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Edit_i-Target V-table-Win
400 ON CHOOSE OF MENU-ITEM m_Edit_i-Target
/* Edit Target
*/
402 RUN edit-target-dialog.
405 /* _UIB-CODE-BLOCK-END
*/
409 &Scoped-define SELF-NAME m_Edit_m-node
410 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Edit_m-node V-table-Win
411 ON CHOOSE OF MENU-ITEM m_Edit_m-node
/* Edit node
*/
413 RUN edit-node-dialog.
416 /* _UIB-CODE-BLOCK-END
*/
420 &Scoped-define SELF-NAME sel_iavail
421 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_iavail V-table-Win
422 ON CURSOR-RIGHT
OF sel_iavail
IN FRAME F-Main
423 OR "CURSOR-LEFT" OF {&SELF-NAME} DO:
427 /* _UIB-CODE-BLOCK-END
*/
431 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_iavail V-table-Win
432 ON MOUSE-SELECT-DBLCLICK
OF sel_iavail
IN FRAME F-Main
434 APPLY '
CHOOSE'
:U
TO btn_iadd .
437 /* _UIB-CODE-BLOCK-END
*/
441 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_iavail V-table-Win
442 ON VALUE-CHANGED
OF sel_iavail
IN FRAME F-Main
444 RUN update-item-buttons.
447 /* _UIB-CODE-BLOCK-END
*/
451 &Scoped-define SELF-NAME sel_icurr
452 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_icurr V-table-Win
453 ON CURSOR-RIGHT
OF sel_icurr
IN FRAME F-Main
454 OR "CURSOR-LEFT" OF {&SELF-NAME} DO:
458 /* _UIB-CODE-BLOCK-END
*/
462 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_icurr V-table-Win
463 ON MOUSE-SELECT-DBLCLICK
OF sel_icurr
IN FRAME F-Main
465 APPLY '
CHOOSE'
:U
TO btn_irem .
468 /* _UIB-CODE-BLOCK-END
*/
472 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_icurr V-table-Win
473 ON VALUE-CHANGED
OF sel_icurr
IN FRAME F-Main
475 RUN update-item-buttons.
478 /* _UIB-CODE-BLOCK-END
*/
482 &Scoped-define SELF-NAME sel_mavail
483 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_mavail V-table-Win
484 ON MOUSE-SELECT-DBLCLICK
OF sel_mavail
IN FRAME F-Main
486 APPLY '
CHOOSE'
:U
TO btn_madd .
489 /* _UIB-CODE-BLOCK-END
*/
493 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_mavail V-table-Win
494 ON VALUE-CHANGED
OF sel_mavail
IN FRAME F-Main
496 RUN update-menu-buttons.
499 /* _UIB-CODE-BLOCK-END
*/
503 &Scoped-define SELF-NAME sel_mcurr
504 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_mcurr V-table-Win
505 ON MOUSE-SELECT-DBLCLICK
OF sel_mcurr
IN FRAME F-Main
507 APPLY '
CHOOSE'
:U
TO btn_mrem .
510 /* _UIB-CODE-BLOCK-END
*/
514 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL sel_mcurr V-table-Win
515 ON VALUE-CHANGED
OF sel_mcurr
IN FRAME F-Main
517 RUN current-menu-changed.
520 /* _UIB-CODE-BLOCK-END
*/
524 &Scoped-define SELF-NAME tgl_topmost
525 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL tgl_topmost V-table-Win
526 ON VALUE-CHANGED
OF tgl_topmost
IN FRAME F-Main
/* On Top ?
*/
528 RUN top-most-changed.
531 /* _UIB-CODE-BLOCK-END
*/
537 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
540 /* *************************** Main Block
*************************** */
542 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
543 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
546 /************************ INTERNAL PROCEDURES
********************/
548 /* _UIB-CODE-BLOCK-END
*/
552 /* ********************** Internal Procedures
*********************** */
554 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE add-item V-table-Win
556 /*------------------------------------------------------------------------------
560 ------------------------------------------------------------------------------*/
562 DO WITH FRAME {&FRAME-NAME}:
563 RUN move-item
( sel_iavail
:HANDLE, sel_icurr
:HANDLE, "C" ).
568 /* _UIB-CODE-BLOCK-END
*/
572 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE add-menu V-table-Win
574 /*------------------------------------------------------------------------------
578 ------------------------------------------------------------------------------*/
580 DO WITH FRAME {&FRAME-NAME}:
582 IF NOT AVAILABLE UsrGroup
THEN RETURN.
584 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
586 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mavail.
587 FIND LinkNode
WHERE LinkNode.NodeCode
= MenuNode.NodeCode
NO-LOCK.
591 UsrGroupMenu.GroupName
= UsrGroup.GroupName
592 UsrGroupMenu.MenuName
= LinkNode.Description
593 UsrGroupMenu.NodeCode
= LinkNode.NodeCode.
595 IF sel_mcurr
:ADD-LAST( UsrGroupMenu.MenuName
) THEN.
596 sel_mcurr
:SCREEN-VALUE = UsrGroupMenu.MenuName.
597 IF sel_mavail
:DELETE( INPUT sel_mavail
) THEN.
599 RUN update-menu-buttons.
602 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
608 /* _UIB-CODE-BLOCK-END
*/
612 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-find-using-key V-table-Win adm/support/_key-fnd.p
613 PROCEDURE adm-find-using-key
:
614 /*------------------------------------------------------------------------------
615 Purpose
: Finds the current record using the contents of
616 the 'Key-Name' and 'Key-Value' attributes.
618 ------------------------------------------------------------------------------*/
619 DEF VAR key-value
AS CHAR NO-UNDO.
620 DEF VAR row-avail-enabled
AS LOGICAL NO-UNDO.
622 /* LOCK status on the find depends on FIELDS-ENABLED.
*/
623 RUN get-attribute
('FIELDS-ENABLED'
:U
).
624 row-avail-enabled
= (RETURN-VALUE eq 'yes'
:U
).
625 /* Look up the current key-value.
*/
626 RUN get-attribute
('Key-Value'
:U
).
627 key-value
= RETURN-VALUE.
629 /* Find the current record using the current Key-Name.
*/
630 RUN get-attribute
('Key-Name'
:U
).
632 WHEN 'GroupName'
:U
THEN
633 {src
/adm
/template
/find-tbl.i
635 &WHERE = "WHERE UsrGroup.GroupName eq key-value"
641 /* _UIB-CODE-BLOCK-END
*/
645 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
646 PROCEDURE adm-row-available
:
647 /*------------------------------------------------------------------------------
648 Purpose
: Dispatched to this procedure when the Record-
649 Source has a new row available. This procedure
650 tries to get the new row
(or foriegn keys
) from
651 the Record-Source and process it.
653 ------------------------------------------------------------------------------*/
655 /* Define variables needed by this internal procedure.
*/
656 {src
/adm
/template
/row-head.i
}
658 /* Process the newly available records
(i.e. display fields
,
659 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
660 {src
/adm
/template
/row-end.i
}
664 /* _UIB-CODE-BLOCK-END
*/
668 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE current-menu-changed V-table-Win
669 PROCEDURE current-menu-changed
:
670 /*------------------------------------------------------------------------------
674 ------------------------------------------------------------------------------*/
678 RUN update-menu-buttons.
682 /* _UIB-CODE-BLOCK-END
*/
686 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
687 PROCEDURE disable_UI
:
688 /*------------------------------------------------------------------------------
689 Purpose
: DISABLE the User Interface
691 Notes
: Here we clean-up the user-interface by deleting
692 dynamic widgets we have created and
/or hide
693 frames. This procedure is usually called when
694 we are ready to
"clean-up" after running.
695 ------------------------------------------------------------------------------*/
696 /* Hide all frames.
*/
698 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
701 /* _UIB-CODE-BLOCK-END
*/
705 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE edit-link-dialog V-table-Win
706 PROCEDURE edit-link-dialog
:
707 /*------------------------------------------------------------------------------
709 ------------------------------------------------------------------------------*/
710 DEF INPUT PARAMETER link-code
AS INT NO-UNDO.
712 FIND ProgramLink
WHERE ProgramLink.LinkCode
= link-code
NO-LOCK.
714 RUN lnk
/d-edtlnk.w
( ProgramLink.LinkCode
).
718 /* _UIB-CODE-BLOCK-END
*/
722 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE edit-node-dialog V-table-Win
723 PROCEDURE edit-node-dialog
:
724 /*------------------------------------------------------------------------------
726 ------------------------------------------------------------------------------*/
727 DO WITH FRAME {&FRAME-NAME}:
729 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mcurr.
730 FIND LinkNode
WHERE LinkNode.NodeCode
= MenuNode.NodeCode
NO-LOCK.
732 RUN lnk
/d-edtnod.w
( LinkNode.NodeCode
).
736 /* _UIB-CODE-BLOCK-END
*/
740 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE edit-target-dialog V-table-Win
741 PROCEDURE edit-target-dialog
:
742 /*------------------------------------------------------------------------------
744 ------------------------------------------------------------------------------*/
745 DO WITH FRAME {&FRAME-NAME}:
747 FIND FIRST ItemNode
WHERE ItemNode.ButtonLabel
= INPUT sel_icurr.
748 FIND ProgramLink
WHERE ProgramLink.LinkCode
= ItemNode.LinkCode
NO-LOCK.
750 RUN lnk
/d-edtnod.w
( ProgramLink.Target
).
754 /* _UIB-CODE-BLOCK-END
*/
758 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
759 PROCEDURE inst-initialize
:
760 /*------------------------------------------------------------------------------
764 ------------------------------------------------------------------------------*/
766 this-win
= {&WINDOW-NAME}:HANDLE .
767 /* tgl_topmost
:SCREEN-VALUE IN FRAME {&FRAME-NAME} = "Yes". */
768 RUN top-most-changed.
772 /* _UIB-CODE-BLOCK-END
*/
776 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-row-available V-table-Win
777 PROCEDURE inst-row-available
:
778 /*------------------------------------------------------------------------------
782 ------------------------------------------------------------------------------*/
784 RUN dispatch
( 'find-using-key'
:u
).
785 IF NOT AVAILABLE UsrGroup
THEN RETURN.
787 CURRENT-WINDOW:TITLE = "Menus - " + UsrGroup.GroupName.
788 IF ROWID( UsrGroup
) <> last-id
THEN RUN refresh-menus.
789 last-id
= ROWID( UsrGroup
).
790 RUN update-node
IN sys-mgr
( THIS-PROCEDURE ).
794 /* _UIB-CODE-BLOCK-END
*/
798 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE item-group-dialog V-table-Win
799 PROCEDURE item-group-dialog
:
800 /*------------------------------------------------------------------------------
802 ------------------------------------------------------------------------------*/
803 DO WITH FRAME {&FRAME-NAME}:
805 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mcurr.
806 FIND FIRST ItemNode
WHERE ItemNode.ButtonLabel
= INPUT sel_icurr.
808 RUN lnk
/d-movlnk.w
( UsrGroup.GroupName
, MenuNode.NodeCode
, ItemNode.LinkCode
).
809 IF RETURN-VALUE = "CHANGED" THEN RUN current-menu-changed.
814 /* _UIB-CODE-BLOCK-END
*/
818 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE menu-group-dialog V-table-Win
819 PROCEDURE menu-group-dialog
:
820 /*------------------------------------------------------------------------------
822 ------------------------------------------------------------------------------*/
823 DO WITH FRAME {&FRAME-NAME}:
825 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mcurr.
827 RUN lnk
/d-movnod.w
( UsrGroup.GroupName
, MenuNode.NodeCode
).
828 IF RETURN-VALUE = "CHANGED" THEN RUN refresh-menus.
832 /* _UIB-CODE-BLOCK-END
*/
836 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE move-item V-table-Win
837 PROCEDURE move-item
:
838 /*------------------------------------------------------------------------------
842 ------------------------------------------------------------------------------*/
844 DEF INPUT PARAMETER h-from
AS HANDLE NO-UNDO.
845 DEF INPUT PARAMETER h-to
AS HANDLE NO-UNDO.
846 DEF INPUT PARAMETER i-status
AS CHAR NO-UNDO.
848 DO WITH FRAME {&FRAME-NAME}:
850 DEF VAR i
AS INT NO-UNDO.
851 DEF VAR sv
AS CHAR NO-UNDO.
852 DEF VAR delim
AS CHAR NO-UNDO.
853 DEF VAR item
AS CHAR NO-UNDO.
855 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
857 delim
= h-from
:DELIMITER.
858 sv
= h-from
:SCREEN-VALUE.
860 DO i
= 1 TO NUM-ENTRIES( sv
, delim
):
862 item
= ENTRY( i
, sv
, delim
).
863 FIND FIRST ItemNode
WHERE ItemNode.ButtonLabel
= item.
864 ASSIGN ItemNode.ItemStatus
= i-status.
866 IF h-to
:ADD-LAST( item
) THEN.
867 IF h-from
:DELETE( item
) THEN.
872 RUN update-item-buttons.
874 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
880 /* _UIB-CODE-BLOCK-END
*/
884 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE move-item-down V-table-Win
885 PROCEDURE move-item-down
:
886 /*------------------------------------------------------------------------------
890 ------------------------------------------------------------------------------*/
892 DO WITH FRAME {&FRAME-NAME}:
894 DEF VAR i
AS INT NO-UNDO.
895 DEF VAR sv
AS CHAR NO-UNDO.
896 DEF VAR li
AS CHAR NO-UNDO.
897 DEF VAR delim
AS CHAR NO-UNDO.
899 sv
= INPUT sel_icurr.
900 li
= sel_icurr
:LIST-ITEMS.
901 delim
= sel_icurr
:DELIMITER.
903 DEF VAR pos
AS INT NO-UNDO.
904 DEF VAR curr-val
AS CHAR NO-UNDO.
906 DO i
= NUM-ENTRIES( sv
, delim
) TO 1 BY -1:
907 curr-val
= ENTRY( i
, sv
, delim
).
908 pos
= LOOKUP( curr-val
, li
, delim
).
909 IF sel_icurr
:REPLACE( sel_icurr
:ENTRY( pos
+ 1 ), pos
) THEN.
910 IF sel_icurr
:REPLACE( curr-val
, pos
+ 1 ) THEN.
914 sel_icurr
:SCREEN-VALUE = sv.
915 RUN update-item-buttons.
921 /* _UIB-CODE-BLOCK-END
*/
925 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE move-item-up V-table-Win
926 PROCEDURE move-item-up
:
927 /*------------------------------------------------------------------------------
931 ------------------------------------------------------------------------------*/
933 DO WITH FRAME {&FRAME-NAME}:
935 DEF VAR i
AS INT NO-UNDO.
936 DEF VAR sv
AS CHAR NO-UNDO.
937 DEF VAR li
AS CHAR NO-UNDO.
938 DEF VAR delim
AS CHAR NO-UNDO.
940 sv
= INPUT sel_icurr.
941 li
= sel_icurr
:LIST-ITEMS.
942 delim
= sel_icurr
:DELIMITER.
944 DEF VAR pos
AS INT NO-UNDO.
945 DEF VAR curr-val
AS CHAR NO-UNDO.
947 DO i
= 1 TO NUM-ENTRIES( sv
, delim
):
948 curr-val
= ENTRY( i
, sv
, delim
).
949 pos
= LOOKUP( curr-val
, li
, delim
).
950 IF sel_icurr
:REPLACE( sel_icurr
:ENTRY( pos
- 1 ), pos
) THEN.
951 IF sel_icurr
:REPLACE( curr-val
, pos
- 1 ) THEN.
955 sel_icurr
:SCREEN-VALUE = sv.
956 RUN update-item-buttons.
962 /* _UIB-CODE-BLOCK-END
*/
966 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-row-available V-table-Win
967 PROCEDURE pre-row-available
:
968 /*------------------------------------------------------------------------------
972 ------------------------------------------------------------------------------*/
978 /* _UIB-CODE-BLOCK-END
*/
982 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE refresh-available-items V-table-Win
983 PROCEDURE refresh-available-items
:
984 /*------------------------------------------------------------------------------
988 ------------------------------------------------------------------------------*/
990 DO WITH FRAME {&FRAME-NAME}:
992 sel_iavail
:LIST-ITEMS = "".
993 DEF VAR screen-label
AS CHAR NO-UNDO.
995 IF NOT AVAILABLE UsrGroup
THEN RETURN.
997 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mcurr
NO-ERROR.
998 IF NOT AVAILABLE MenuNode
THEN RETURN.
1000 FIND LinkNode
WHERE LinkNode.NodeCode
= MenuNode.NodeCode
NO-LOCK.
1001 FIND UsrGroupMenu
OF UsrGroup
WHERE
1002 UsrGroupMenu.NodeCode
= LinkNode.NodeCode
NO-LOCK.
1004 IF LinkNode.NodeType
= "MN" THEN
1005 FIND LinkNode
WHERE LinkNode.File
= 'win
/w-mainmn.w'
:U
NO-LOCK.
1007 FOR EACH ProgramLink
NO-LOCK WHERE
1008 ProgramLink.Source
= LinkNode.NodeCode
AND
1009 NOT CAN-FIND( FIRST UsrGroupMenuItem
OF UsrGroupMenu
WHERE
1010 UsrGroupMenuItem.LinkCode
= ProgramLink.LinkCode
):
1012 /* IF ProgramLink.Target
= LinkNode.NodeCode
THEN NEXT.
*/
1014 /* This will ensure uniqueness by tagging with the linkcode
*/
1015 screen-label
= ProgramLink.ButtonLabel
+ FILL( " ", 100 ) + STRING( ProgramLink.LinkCode
).
1017 IF sel_iavail
:ADD-LAST( screen-label
) THEN DO:
1020 ItemNode.LinkCode
= ProgramLink.LinkCode
1021 ItemNode.ButtonLabel
= screen-label
1022 ItemNode.ItemStatus
= "A".
1027 RUN update-item-buttons.
1033 /* _UIB-CODE-BLOCK-END
*/
1037 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE refresh-current-items V-table-Win
1038 PROCEDURE refresh-current-items
:
1039 /*------------------------------------------------------------------------------
1043 ------------------------------------------------------------------------------*/
1045 DO WITH FRAME {&FRAME-NAME}:
1047 DEF VAR screen-label
AS CHAR NO-UNDO.
1049 sel_icurr
:LIST-ITEMS = "".
1051 IF NOT AVAILABLE UsrGroup
THEN RETURN.
1053 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mcurr
NO-ERROR.
1054 IF NOT AVAILABLE MenuNode
THEN RETURN.
1056 FIND LinkNode
WHERE LinkNode.NodeCode
= MenuNode.NodeCode
NO-LOCK.
1057 FIND UsrGroupMenu
OF UsrGroup
WHERE
1058 UsrGroupMenu.NodeCode
= LinkNode.NodeCode
NO-LOCK.
1060 FOR EACH UsrGroupMenuItem
OF UsrGroupMenu
NO-LOCK
1061 BY UsrGroupMenuItem.SequenceCode
:
1063 /* This will ensure label uniqueness by tagging with the linkcode
*/
1064 screen-label
= UsrGroupMenuItem.ButtonLabel
+ FILL( " ", 100 ) + STRING( UsrGroupMenuItem.LinkCode
).
1065 IF sel_icurr
:ADD-LAST( screen-label
) THEN
1069 ItemNode.LinkCode
= UsrGroupMenuItem.LinkCode
1070 ItemNode.ButtonLabel
= screen-label
1071 ItemNode.ItemStatus
= "C".
1076 RUN update-item-buttons.
1083 /* _UIB-CODE-BLOCK-END
*/
1087 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE refresh-items V-table-Win
1088 PROCEDURE refresh-items
:
1089 /*------------------------------------------------------------------------------
1093 ------------------------------------------------------------------------------*/
1095 DO WITH FRAME {&FRAME-NAME}:
1097 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
1099 sel_iavail
:LIST-ITEMS = "".
1100 sel_icurr
:LIST-ITEMS = "".
1102 FOR EACH ItemNode
: DELETE ItemNode.
END.
1104 RUN refresh-available-items.
1105 RUN refresh-current-items.
1106 RUN update-item-buttons.
1108 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
1114 /* _UIB-CODE-BLOCK-END
*/
1118 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE refresh-menus V-table-Win
1119 PROCEDURE refresh-menus
:
1120 /*------------------------------------------------------------------------------
1124 ------------------------------------------------------------------------------*/
1126 DO WITH FRAME {&FRAME-NAME}:
1128 DEF VAR stat
AS LOGI
NO-UNDO.
1130 sel_mavail
:LIST-ITEMS = "".
1131 sel_mcurr
:LIST-ITEMS = "".
1133 IF NOT AVAILABLE UsrGroup
THEN RETURN.
1135 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
1137 FOR EACH MenuNode
: DELETE MenuNode.
END.
1139 FOR EACH LinkNode
NO-LOCK WHERE
1140 LinkNode.NodeType
<> "MV":
1142 IF CAN-FIND( FIRST UsrGroupMenu
WHERE
1143 UsrGroupMenu.Groupname
= UsrGroup.GroupName
AND
1144 UsrGroupMenu.NodeCode
= LinkNode.NodeCode
) THEN
1146 stat
= sel_mcurr
:ADD-LAST( LinkNode.Description
).
1150 LinkNode.NodeType
= 'MN'
OR
1151 CAN-FIND( FIRST ProgramLink
WHERE ProgramLink.Source
= LinkNode.NodeCode
)
1154 stat
= sel_mavail
:ADD-LAST( LinkNode.Description
).
1160 MenuNode.NodeCode
= LinkNode.NodeCode
1161 MenuNode.Description
= LinkNode.Description.
1168 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
1174 /* _UIB-CODE-BLOCK-END
*/
1178 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE remove-item V-table-Win
1179 PROCEDURE remove-item
:
1180 /*------------------------------------------------------------------------------
1184 ------------------------------------------------------------------------------*/
1186 DO WITH FRAME {&FRAME-NAME}:
1187 RUN move-item
( sel_icurr
:HANDLE, sel_iavail
:HANDLE, "A" ).
1192 /* _UIB-CODE-BLOCK-END
*/
1196 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE remove-menu V-table-Win
1197 PROCEDURE remove-menu
:
1198 /*------------------------------------------------------------------------------
1202 ------------------------------------------------------------------------------*/
1204 DO WITH FRAME {&FRAME-NAME}:
1206 IF NOT AVAILABLE UsrGroup
THEN RETURN.
1208 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
1210 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mcurr.
1211 FIND LinkNode
WHERE LinkNode.NodeCode
= MenuNode.NodeCode
NO-LOCK.
1212 FIND UsrGroupMenu
OF UsrGroup
WHERE
1213 UsrGroupMenu.NodeCode
= LinkNode.NodeCode
EXCLUSIVE-LOCK.
1214 DELETE UsrGroupMenu.
1216 IF sel_mavail
:ADD-LAST( INPUT sel_mcurr
) THEN.
1217 sel_mavail
:SCREEN-VALUE = INPUT sel_mcurr.
1218 IF sel_mcurr
:DELETE( INPUT sel_mcurr
) THEN.
1220 RUN update-menu-buttons.
1223 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
1229 /* _UIB-CODE-BLOCK-END
*/
1233 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE save-items V-table-Win
1234 PROCEDURE save-items
:
1235 /*------------------------------------------------------------------------------
1239 ------------------------------------------------------------------------------*/
1241 DO WITH FRAME {&FRAME-NAME}:
1243 IF NOT AVAILABLE UsrGroup
THEN RETURN.
1245 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
1247 FIND FIRST MenuNode
WHERE MenuNode.Description
= INPUT sel_mcurr
NO-ERROR.
1248 IF NOT AVAILABLE MenuNode
THEN RETURN.
1250 FIND LinkNode
WHERE LinkNode.NodeCode
= MenuNode.NodeCode
NO-LOCK.
1251 FIND UsrGroupMenu
OF UsrGroup
WHERE
1252 UsrGroupMenu.NodeCode
= LinkNode.NodeCode
NO-LOCK.
1254 FOR EACH UsrGroupMenuItem
OF UsrGroupMenu
:
1255 FIND FIRST ItemNode
WHERE ItemNode.LinkCode
= UsrGroupMenuItem.LinkCode.
1256 IF ItemNode.ItemStatus
= "A" THEN DELETE UsrGroupMenuItem.
1259 DEF VAR i
AS INT NO-UNDO.
1260 DEF VAR li
AS CHAR NO-UNDO.
1261 DEF VAR delim
AS CHAR NO-UNDO.
1262 DEF VAR item
AS CHAR NO-UNDO.
1264 li
= sel_icurr
:LIST-ITEMS.
1265 delim
= sel_icurr
:DELIMITER.
1267 DO i
= 1 TO NUM-ENTRIES( li
, delim
):
1268 item
= ENTRY( i
, li
, delim
).
1269 FIND FIRST ItemNode
WHERE ItemNode.ButtonLabel
= item.
1270 FIND ProgramLink
WHERE ProgramLink.LinkCode
= ItemNode.LinkCode
NO-LOCK.
1271 FIND FIRST UsrGroupMenuItem
OF UsrGroupMenu
1272 WHERE UsrGroupMenuItem.LinkCode
= ItemNode.LinkCode
NO-ERROR.
1274 IF NOT AVAILABLE UsrGroupMenuItem
THEN
1276 CREATE UsrGroupMenuItem.
1278 UsrGroupMenuItem.GroupName
= UsrGroup.GroupName
1279 UsrGroupMenuItem.MenuName
= UsrGroupMenu.MenuName
1280 UsrGroupMenuItem.LinkCode
= ProgramLink.LinkCode
1281 UsrGroupMenuItem.ButtonLabel
= ProgramLink.ButtonLabel.
1284 ASSIGN UsrGroupMenuItem.SequenceCode
= i.
1289 RUN update-item-buttons.
1291 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
1297 /* _UIB-CODE-BLOCK-END
*/
1301 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key V-table-Win adm/support/_key-snd.p
1302 PROCEDURE send-key
:
1303 /*------------------------------------------------------------------------------
1304 Purpose
: Sends a requested
KEY value back to the calling
1306 Parameters
: <see adm
/template
/sndkytop.i
>
1307 ------------------------------------------------------------------------------*/
1309 /* Define variables needed by this internal procedure.
*/
1310 {src
/adm
/template
/sndkytop.i
}
1312 /* Return the key value associated with each key case.
*/
1313 {src
/adm
/template
/sndkycas.i
"GroupName" "UsrGroup" "GroupName"}
1315 /* Close the
CASE statement and end the procedure.
*/
1316 {src
/adm
/template
/sndkyend.i
}
1320 /* _UIB-CODE-BLOCK-END
*/
1324 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
1325 PROCEDURE send-records
:
1326 /*------------------------------------------------------------------------------
1327 Purpose
: Send record
ROWID's for all tables used by
1329 Parameters
: see template
/snd-head.i
1330 ------------------------------------------------------------------------------*/
1332 /* SEND-RECORDS does nothing because there are no External
1333 Tables specified for this SmartViewer
, and there are no
1334 tables specified in any contained Browse
, Query
, or Frame.
*/
1338 /* _UIB-CODE-BLOCK-END
*/
1342 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
1343 PROCEDURE state-changed
:
1344 /* -----------------------------------------------------------
1348 -------------------------------------------------------------*/
1349 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
1350 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
1353 /* Object instance CASEs can go here to replace standard behavior
1354 or add new cases.
*/
1355 {src
/adm
/template
/vstates.i
}
1359 /* _UIB-CODE-BLOCK-END
*/
1363 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE top-most-changed V-table-Win
1364 PROCEDURE top-most-changed
:
1365 /*------------------------------------------------------------------------------
1367 ------------------------------------------------------------------------------*/
1369 IF INPUT FRAME {&FRAME-NAME} tgl_topmost THEN
1370 RUN notify
( 'set-topmost
,container-source'
:U
).
1372 RUN notify
( 'reset-topmost
,container-source'
:U
).
1376 /* _UIB-CODE-BLOCK-END
*/
1380 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-buttons V-table-Win
1381 PROCEDURE update-buttons
:
1382 /*------------------------------------------------------------------------------
1386 ------------------------------------------------------------------------------*/
1388 RUN update-menu-buttons.
1389 RUN update-item-buttons.
1393 /* _UIB-CODE-BLOCK-END
*/
1397 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-item-buttons V-table-Win
1398 PROCEDURE update-item-buttons
:
1399 /*------------------------------------------------------------------------------
1403 ------------------------------------------------------------------------------*/
1405 DO WITH FRAME {&FRAME-NAME}:
1406 btn_iadd
:SENSITIVE = sel_iavail
:SCREEN-VALUE <> "" AND sel_iavail
:SCREEN-VALUE <> ?.
1407 btn_irem
:SENSITIVE = sel_icurr
:SCREEN-VALUE <> "" AND sel_icurr
:SCREEN-VALUE <> ?.
1411 DEF VAR delim
AS CHAR NO-UNDO.
1412 delim
= sel_icurr
:DELIMITER.
1415 ( sel_icurr
:SCREEN-VALUE <> "" AND sel_icurr
:SCREEN-VALUE <> ?
) AND
1416 ENTRY( 1, INPUT sel_icurr
, delim
) <> ENTRY( 1, sel_icurr
:LIST-ITEMS, delim
).
1417 btn_idown
:SENSITIVE =
1418 ( sel_icurr
:SCREEN-VALUE <> "" AND sel_icurr
:SCREEN-VALUE <> ?
) AND
1419 ENTRY( NUM-ENTRIES( INPUT sel_icurr
, delim
), INPUT sel_icurr
, delim
) <>
1420 ENTRY( NUM-ENTRIES( sel_icurr
:LIST-ITEMS, delim
), sel_icurr
:LIST-ITEMS, delim
).
1422 btn_save
:SENSITIVE = menu-altered.
1428 /* _UIB-CODE-BLOCK-END
*/
1432 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-menu-buttons V-table-Win
1433 PROCEDURE update-menu-buttons
:
1434 /*------------------------------------------------------------------------------
1438 ------------------------------------------------------------------------------*/
1440 DO WITH FRAME {&FRAME-NAME}:
1441 btn_madd
:SENSITIVE = sel_mavail
:SCREEN-VALUE <> "" AND sel_mavail
:SCREEN-VALUE <> ?.
1442 btn_mrem
:SENSITIVE = sel_mcurr
:SCREEN-VALUE <> "" AND sel_mcurr
:SCREEN-VALUE <> ?.
1447 /* _UIB-CODE-BLOCK-END
*/