New to Progress,

Posted by Admin on 28-Oct-2009 19:39

Hi,

I am new to Progress and have decided to learn it because we use a large progress database as a main source of input and documentation for business. So far I have been able to create a temp table, populate it and push it into Excel for viewing. However I have a simple problem that is really getting to me,

I want to be able to create a fill in within the frame and have the user input an order number into it and on the push of a button I want the order number assigned to a variable which i can then push through to a query,

Can someone help me with this please?

All Replies

Posted by Admin on 29-Oct-2009 01:06

I am new to Progress

Welcome

I want to be able to create a fill in within the frame and

have the user input an order number into it and on the push

of a button I want the order number assigned to a variable

which i can then push through to a query,

 

Are you creating your UI dynamically? Using AppBuilder or pure source code?

1) Dynamically:

Check the CREATE FILL-IN statement.

DEFINE VARIABLE hFillIn AS HANDLE NO-UNDO.

CREATE FILL-IN hFillIn

ASSIGN FRAME = {&FRAME-NAME}:HANDLE /* or whatever reference to the frame you have */

WIDTH = 20

HEIGHT = 10

SENSITIVE = TRUE

/* Add additional properties as required */

.

To read the current screen value, use hFillIn:SCREEN-VALUE.

2) AppBuilder:

Just drop the fill-in from the palette on the screen and assign relevant properties using the property sheet (double click). To read the value use:

ASSIGN FRAME {&FRAME-NAME} fill-in-1 . /* or whatever name you or the appbuilder have given */

The value will be stored in the variable fill-in-1 now.

3) pure source code

Just define a variable and include it in a FORM statement.

DEFINE VARIABLE fill-in-1 AS INTEGER NO-UNDO.

FORM ....

fill-in-1

....

WITH FRAME name-of-your-frame .

ENABLE fill-in-1 WITH FRAME name-of-your-frame . /* this will allow user input */

ASSIGN FRAME name-of-your-frame fill-in-1 . /* this will assign the current value to the variable fill-in-1. */

I know nothing about your environment, but since you are starting you might not have any ABL GUI related legacy code. GUI for .NET might be worth looking at. It's supported since 10.2A. The Progress documentation and the GUI for .NET forum here have good references for that.

Posted by Admin on 29-Oct-2009 20:16

I have been using a combination of appbuilder and then pure source code as I'm not competent in either its probably a haphazard way of doing it

So if i am reading this right the "fill-in-1" is the variable name and the name of the widget?

Posted by Admin on 29-Oct-2009 22:42

OK i have checked this and it works great! thankyou

I now have another issue,

I am using a button to output the value in the fill in (just for testing purposes) and I need to click it five or six times before it displays something, any ideas on this?

Cheers,

Posted by Admin on 30-Oct-2009 04:21

I am using a button to output the value in the fill in (just for testing purposes)

and I need to click it five or six times before it displays something, any ideas on

this?

 

In the definitions section:

DEFINE VARIABLE iCounter AS INTEGER NO-UNDO .

In the ON CHOOSE OF BUTTON-1 Trigger:

ASSIGN iCounter = iCounter + 1 .

IF iCounter = 5 THEN

MESSAGE "Display something" VIEW-AS ALERT-BOX .

Posted by Admin on 01-Nov-2009 15:36

thanks for your help mike but i think i have been misunderstood (i should have been more specific). Currently as the code stands i need to click the button 5 or six times in order for it to display however I only want to click it once. I have put no other variables into the code or counters or loops. I'm lost.

Here is the code as generated by the app builder

&ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI ADM2

&ANALYZE-RESUME

&Scoped-define WINDOW-NAME wWin

{adecomm/appserv.i}

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS wWin

CREATE WIDGET-POOL.

/* ***************************  Definitions  ************************** */

/* Parameters Definitions ---                                           */

/* Local Variable Definitions ---                                       */

{src/adm2/widgetprto.i}

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK

/* ********************  Preprocessor Definitions  ******************** */

&Scoped-define PROCEDURE-TYPE SmartWindow

&Scoped-define DB-AWARE no

&Scoped-define ADM-CONTAINER WINDOW

&Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source

/* Name of designated FRAME-NAME and/or first browse and/or first query */

&Scoped-define FRAME-NAME fMain

/* Standard List Definitions                                            */

&Scoped-Define ENABLED-OBJECTS FILL-IN-1 BUTTON-1

&Scoped-Define DISPLAYED-OBJECTS FILL-IN-1

/* Custom List Definitions                                              */

/* List-1,List-2,List-3,List-4,List-5,List-6                            */

/* _UIB-PREPROCESSOR-BLOCK-END */

&ANALYZE-RESUME

/* ***********************  Control Definitions  ********************** */

/* Define the widget handle for the window                              */

DEFINE VAR wWin AS WIDGET-HANDLE NO-UNDO.

/* Definitions of the field level widgets                               */

DEFINE BUTTON BUTTON-1

     LABEL "Button 1"

     SIZE 15 BY 1.14.

DEFINE VARIABLE FILL-IN-1 AS INTEGER FORMAT "->>>>>>9":U INITIAL 0

     VIEW-AS FILL-IN

     SIZE 14 BY 1 NO-UNDO.

/* ************************  Frame Definitions  *********************** */

DEFINE FRAME fMain

     FILL-IN-1 AT ROW 1.95 COL 29 COLON-ALIGNED NO-LABEL WIDGET-ID 4

     BUTTON-1 AT ROW 3.38 COL 40 WIDGET-ID 8

    WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY

         SIDE-LABELS NO-UNDERLINE THREE-D

         AT COL 1 ROW 1

         SIZE 80 BY 17 WIDGET-ID 100.

/* *********************** Procedure Settings ************************ */

&ANALYZE-SUSPEND _PROCEDURE-SETTINGS

/* Settings for THIS-PROCEDURE

   Type: SmartWindow

   Allow: Basic,Browse,DB-Fields,Query,Smart,Window

   Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source

   Other Settings: APPSERVER

*/

&ANALYZE-RESUME _END-PROCEDURE-SETTINGS

/* *************************  Create Window  ************************** */

&ANALYZE-SUSPEND _CREATE-WINDOW

IF SESSION:DISPLAY-TYPE = "GUI":U THEN

  CREATE WINDOW wWin ASSIGN

         HIDDEN             = YES

         TITLE              = ""

         HEIGHT             = 17

         WIDTH              = 80

         MAX-HEIGHT         = 28.81

         MAX-WIDTH          = 146.2

         VIRTUAL-HEIGHT     = 28.81

         VIRTUAL-WIDTH      = 146.2

         RESIZE             = no

         SCROLL-BARS        = no

         STATUS-AREA        = no

         BGCOLOR            = ?

         FGCOLOR            = ?

         THREE-D            = yes

         MESSAGE-AREA       = no

         SENSITIVE          = yes.

ELSE {&WINDOW-NAME} = CURRENT-WINDOW.

/* END WINDOW DEFINITION                                                */

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "SmartWindowCues" wWin _INLINE

/* Actions: adecomm/_so-cue.w ? adecomm/_so-cued.p ? adecomm/_so-cuew.p */

/* SmartWindow,ab,49271

Destroy on next read */

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB wWin

/* ************************* Included-Libraries *********************** */

{src/adm2/containr.i}

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

/* ***********  Runtime Attributes and AppBuilder Settings  *********** */

&ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES

/* SETTINGS FOR WINDOW wWin

  VISIBLE,,RUN-PERSISTENT                                               */

/* SETTINGS FOR FRAME fMain

   FRAME-NAME                                                           */

IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wWin)

THEN wWin:HIDDEN = yes.

/* _RUN-TIME-ATTRIBUTES-END */

&ANALYZE-RESUME

/* ************************  Control Triggers  ************************ */

&Scoped-define SELF-NAME wWin

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL wWin wWin

ON END-ERROR OF wWin /* */

OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:

  /* This case occurs when the user presses the "Esc" key.

     In a persistently run window, just ignore this.  If we did not, the

     application would exit. */

  IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY.

END.

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL wWin wWin

ON WINDOW-CLOSE OF wWin /* */

DO:

  /* This ADM code must be left here in order for the SmartWindow

     and its descendents to terminate properly on exit. */

  APPLY "CLOSE":U TO THIS-PROCEDURE.

  RETURN NO-APPLY.

END.

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&Scoped-define SELF-NAME BUTTON-1

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BUTTON-1 wWin

ON CHOOSE OF BUTTON-1 IN FRAME fMain /* Button 1 */

DO:

  DISPLAY FILL-IN-1:SCREEN-VALUE.

END.

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&UNDEFINE SELF-NAME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK wWin

/* ***************************  Main Block  *************************** */

/* Include custom  Main Block code for SmartWindows. */

{src/adm2/windowmn.i}

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

/* **********************  Internal Procedures  *********************** */

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects wWin  _ADM-CREATE-OBJECTS

PROCEDURE adm-create-objects :

/*------------------------------------------------------------------------------

  Purpose:     Create handles for all SmartObjects used in this procedure.

               After SmartObjects are initialized, then SmartLinks are added.

  Parameters: 

------------------------------------------------------------------------------*/

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI wWin  _DEFAULT-DISABLE

PROCEDURE disable_UI :

/*------------------------------------------------------------------------------

  Purpose:     DISABLE the User Interface

  Parameters: 

  Notes:       Here we clean-up the user-interface by deleting

               dynamic widgets we have created and/or hide

               frames.  This procedure is usually called when

               we are ready to "clean-up" after running.

------------------------------------------------------------------------------*/

  /* Delete the WINDOW we created */

  IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wWin)

  THEN DELETE WIDGET wWin.

  IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI wWin  _DEFAULT-ENABLE

PROCEDURE enable_UI :

/*------------------------------------------------------------------------------

  Purpose:     ENABLE the User Interface

  Parameters: 

  Notes:       Here we display/view/enable the widgets in the

               user-interface.  In addition, OPEN all queries

               associated with each FRAME and BROWSE.

               These statements here are based on the "Other

               Settings" section of the widget Property Sheets.

------------------------------------------------------------------------------*/

  DISPLAY FILL-IN-1

      WITH FRAME fMain IN WINDOW wWin.

  ENABLE FILL-IN-1 BUTTON-1

      WITH FRAME fMain IN WINDOW wWin.

  {&OPEN-BROWSERS-IN-QUERY-fMain}

  VIEW wWin.

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE exitObject wWin

PROCEDURE exitObject :

/*------------------------------------------------------------------------------

  Purpose:  Window-specific override of this procedure which destroys

            its contents and itself.

    Notes: 

------------------------------------------------------------------------------*/

  APPLY "CLOSE":U TO THIS-PROCEDURE.

  RETURN.

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME

Message was edited by: Tim Smith

Posted by Håvard Danielsen on 03-Nov-2009 09:43

The choose trigger do fire each time you press the button. Try something like message fill-in1:screen-value view-as alert-box.

The reason why you do not see the display initially is that you are using a frame that is not defined in the window.  The display statement will always use a frame. In your case you are using a default (un-named) frame, whose default behavior is to position itself below any existing frame as long as there are sufficient space available. In your case there seems to be enough space underneath to display the frame 4 - 5 times (I assume because the window virtual-height is bigger than the visible height). When there is no more space below it will start on top overlaying existing frames and this is when you see it. The default positioning of frames are controllable and predictable (or at least explainable after you see what happens), but  rarely makes sense in GUI.          

Posted by Admin on 04-Nov-2009 18:59

put this into the code and got the error below.

to get around this i created another fill in and made the screen value of it equal the screen value of the first one on button press. This should be sufficient enough,

Cheers.

Posted by Admin on 05-Nov-2009 01:16

Try

MESSAGE fill-in-1:SCREEN-VALUE IN FRAME {&FRAME-NAME}

    VIEW-AS ALERT-BOX .

ABL statements need to be terminated with a dot.

Posted by Admin on 05-Nov-2009 16:08

awesome work!!!!

Thanks for all your assistance!! it is greatly appreciated.

This thread is closed