Kbase P17868: How to make the browser insensitive when modifying a record
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
GOAL:
How to make the browser insensitive when modifying a record
GOAL:
In Dynamics if there is a smartbrowser and a smartviewer and the user is modifying a record in the viewer then before they select a field to modify it is possible to change record in the smartbrowser, how to avoid this ability to change record?
FACT(s) (Environment):
Dynamics 2.0a
FIX:
The basic code would be:
1. Create a standard procedure for the dynamic browser and add a simple procedure 'lockb' with the following code:
DEFINE VARIABLE hBrowse AS HANDLE NO-UNDO.
{get BrowseHandle hBrowse}.
hBrowse:SENSITIVE = NO.
END PROCEDURE.
As you can see this simply makes the browse widget insensitive.
In the viewer, link a standard procedure and in the updatemode procedure get the handle to the browser and then run this lockb procedure when we are in update mode which appears to achieve the basic requirement of not allowing the user to move to a different record after the modify button is pressed:
DEF INPUT PARAM pcmode AS CHAR.
DEF VAR myh AS HANDLE.
DEF VAR myc AS CHAR.
DEF VAR i AS INT.
DEF VAR myh2 AS HANDLE.
RUN SUPER (INPUT pcmode).
IF pcmode = "modify" THEN DO:
myh = DYNAMIC-FUNCTION('getdatasource' IN TARGET-PROCEDURE).
myc = DYNAMIC-FUNCTION('getdatatarget' IN myh).
DO i = 1 TO NUM-ENTRIES(myc):
DEF VAR myproc AS CHAR.
myh2 = WIDGET-HANDLE(ENTRY(i,myc)).
ASSIGN myproc = DYNAMIC-FUNCTION('getObjectType' IN myh2).
IF myproc = "SmartDataBrowser" THEN DO:
RUN lockb IN myh2.
END.
END.
END.
END PROCEDURE.
This may befurther refined to:
In the Browser-Procedure:
/*****
DEFINE INPUT PARAMETER lMode AS LOGICAL NO-UNDO.
DEFINE VARIABLE hBrowse AS HANDLE NO-UNDO.
{get BrowseHandle hBrowse}.
ASSIGN hBrowse:SENSITIVE = lMode.
*****/
In de UpdateMode:
/*****
DEFINE INPUT PARAMETER pcMode AS CHARACTER NO-UNDO.
DEFINE VARIABLE cType AS CHARACTER NO-UNDO.
DEFINE VARIABLE cDataTarget AS CHARACTER NO-UNDO.
DEFINE VARIABLE cParam AS CHARACTER NO-UNDO.
DEFINE VARIABLE lGelukt AS LOGICAL NO-UNDO.
DEFINE VARIABLE I AS INTEGER NO-UNDO.
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE hSource AS HANDLE NO-UNDO.
DEFINE VARIABLE hTableIOSource AS HANDLE NO-UNDO.
RUN SUPER(INPUT pcMode).
{Get DataSource hDataSource}.
{get TableIOSource hTableIOSource}.
ASSIGN cDataTarget = DYNAMIC-FUNCTION("GetDataTarget" IN
hDataSource).
DO I = 1 TO NUM-ENTRIES(cDataTarget):
ASSIGN hSource = WIDGET-HANDLE(ENTRY(I,cDataTarget))
cType = DYNAMIC-FUNCTION('GetObjectType' IN hSource).
IF cType EQ "SmartDataBrowser" AND
pcMode EQ "Modify"
THEN DO:
ASSIGN cParam = "First,Prev,Next,Last":U
lGelukt = DYNAMIC-FUNCTION('setDisabledActions'
IN hTableIOSource, cParam).
RUN BrowserMode IN hSource(INPUT FALSE).
RETURN.
END.
RUN BrowserMode IN hSource(INPUT TRUE) NO-ERROR.
END.
ASSIGN lGelukt = DYNAMIC-FUNCTION('setDisabledActions'
IN hTableIOSource, "").
PUBLISH 'resetTableio':U FROM TARGET-PROCEDURE.
*****/