How to creat your own object open edge 10.2b

jmac13

Member
Hi all,

I'm trying to add a custom selection list to appbuilder. this selection list will act in a certian way with different codes in the triggers etc. my question is rather than having to copy my code from another program every time can I add to the appbuilder somehow so its an option in the selection and thus having Generic code in there for me to change?

Can anyone point me in the right direction cheers
 
Create you custom.w ... save the custom.w in %DLC%\src\template\custom.w

and add to progress.cst:

*NEW-CONTAINER &Custom
NEW-TEMPLATE src/template/custom.w

re-start appbuilder ...
 
is this just for creating a template rather than an actual object? i just want a selection box that has different code in to the default one
 
just copy the selection box which exist and add TRIGGER CHOOSE like the temlplate of button ...

[h=2]Adding a widget to a palette button pop-up menu[/h] You create and define custom widgets in a custom object file. The following is the syntax for adding custom widgets:


*widget-type name
[ DESCRIPTION [ description-text-string ] ]
{ [ attribute value ] ...
[ INHERIT name-of-entry ] ...
[ trigger-block ] ...
} ...
RUN file-name


Syntax


*widget-type Specifies the type of custom widget to create. It must be one of the following: BROWSE, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, TEXT, and TOGGLE-BOX.
name Specifies the display name of the custom widget as it appears on the Palette submenu (or pop-up menu on the Palette). After you choose a widget, AppBuilder displays display-name, followed by widget-type, in the status bar of AppBuilder main window.
DESCRIPTION [ description-text-string ] Specifies the description of the widget. The description helps another developer to read and understand the intent of each custom widget.
attribute Specifies an attribute to set for the widget. You can specify any attribute that you can also set from the widget’s property sheet. See Table C–2, later in this appendix, for a list of the attributes that you can specify and the widgets to which they can apply.
value Specifies the value for attribute (based on the data type of the attribute).
INHERIT name-of-entry Specifies the display name of another widget in the custom widgets file. The current widget inherits all of the attribute settings specified for the other widget. If attribute settings conflict, the latter setting applies.
trigger-block Specifies a trigger for the custom widget, as shown:


TRIGGER event
DO [ trigger-code ] END.
END TRIGGER


Syntax

In this syntax, event specifies an event to pair with the custom widget and trigger-code specifies the code statements to execute for the widget/event pair.
RUN file-name Specifies a procedure to run immediately before the object is created. The procedure file can take two parameters:

  • INPUT p_id AS INTEGER NO-UNDO - The context ID of the object being created.
  • OUTPUT p_sct AS CHAR NO-UNDO - A list of new custom object entries to process.
    You can have multiple RUN statements for a single custom object file; they are run sequentially. Do not end a RUN statement line with a trailing period (.).

Table C–2 describes the attributes you can set in the custom objects file and the widgets to which they apply.

AUTO-COMPLETION
Logical
COMBO BOX
AUTO-END-KEY
Logical
BUTTON
AUTO-GO
Logical
BUTTON
AUTO-INDENT
Logical
BUTTON, EDITOR, FILL-IN, SELECTION-LIST, TOGGLE-BOX
AUTO-RESIZE
Logical
BUTTON, EDITOR, FILL-IN, SELECTION-LIST, SLIDER, TOGGLE-BOX
AUTO-RETURN
Logical
FILL-IN
BGCOLOR
Integer
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
BLANK
Logical
COMBO-BOX, FILL-IN
BOX-SELECTABLE
Logical
FRAME
CANCEL-BUTTON
Logical
BUTTON
COLUMN-SCROLLING
Logical
BROWSER
DATA-TYPE
Character
COMBO-BOX, FILL-IN, RADIO-SET
DEBLANK
Logical
COMBO-BOX, FILL-IN
DEFAULT-BUTTON
Logical
BUTTON
DEFAULT-STYLE
Logical
BUTTON
DISPLAY
Logical
COMBO-BOX, EDITOR, FILL-IN, RADIO-SET, SELECTION-LIST, SLIDER, TOGGLE-BOX
DOWN
Logical
FRAME
DRAG-ENABLED
Logical
SELECTION-LIST
EDGE-PIXELS
Integer
RECTANGLE
ENABLE
Logical
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TOGGLE-BOX
EXPAND
Logical
RADIO-SET
FGCOLOR
Integer
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
FILLED
Logical
RECTANGLE
FONT
Integer
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, RADIO-SET, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
FORMAT
Character
COMBO-BOX, FILL-IN
GRAPHIC-EDGE
Logical
RECTANGLE
HEIGHT
Integer
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
HEIGHT-PIXELS
Integer
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
HELP
Character
BUTTON, COMBO-BOX, EDITOR, FILL-IN, RADIO-SET, SELECTION-LIST, SLIDER, TOGGLE-BOX
HIDDEN
Logical
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
HORIZONTAL
Logical
RADIO-SET, SLIDER
IMAGE-DOWN
Character
BUTTON
IMAGE-FILE
Character
BUTTON, IMAGE
IMAGE-INSENSITIVE
Character
BUTTON
INITIAL-VALUE
Character
COMBO-BOX, EDITOR, FILL-IN, RADIO-SET, SELECTION-LIST, SLIDER, TOGGLE-BOX
INNER-LINES
Integer
COMBO-BOX
KEEP-TAB-ORDER
Logical
FRAME
LABEL
Character
BROWSER, BUTTON, COMBO-BOX, FILL-IN, FRAME, TOGGLE-BOX
LARGE
Logical
EDITOR
LAYOUT-UNIT
Character or P
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
LIST-ITEMS
Character
COMBO-BOX, RADIO-SET, SELECTION-LIST
LOCK-COLUMNS
Integer
BROWSER
MANUAL-HIGHLIGHT
Logical
BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
MAX CHARS
Integer
EDITOR
MAX-DATA-GUESS
Integer
BROWSER
MAX-VALUE
Integer
SLIDER
MIN-VALUE
Integer
SLIDER
MOVABLE
Logical
BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
MULTIPLE
Logical
BROWSER, SELECTION-LIST
NAME
Character
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TOGGLE-BOX
NATIVE
Logical
FILL-IN
NO-BOX
Logical
BROWSER, FRAME
NO-HIDE
Logical
FRAME
NO-LABEL
Logical
COMBO-BOX, FILL-IN
NO-LABELS
Logical
BROWSER, FRAME
NO-UNDERLINE
Logical
FRAME
NO-UNDO
Logical
COMBO-BOX, EDITOR, FILL-IN, RADIO-SET, SELECTION-LIST, SLIDER, TOGGLE-BOX
NO-VALIDATE
Logical
FRAME
OPEN-QUERY
Logical
BROWSER, FRAME
OVERLAY
Logical
FRAME
PAGE-BOTTOM
Logical
FRAME
PAGE-TOP
Logical
FRAME
PRIVATE-DATA
Character
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
RADIO-BUTTONS[SUP]1[/SUP]
Character
RADIO-SET
READ-ONLY
Logical
EDITOR
RESIZABLE
Logical
BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
RETAIN
Integer
FRAME
RETURN-INSERTED
Logical
EDITOR
SCROLLABLE
Logical
FRAME
SCROLLBAR-HORIZONTAL
Logical
EDITOR, SELECTION-LIST
SCROLLBAR-VERTICAL
Logical
EDITOR, SELECTION-LIST
SELECTABLE
Logical
BUTTON, COMBO-BOX, EDITOR, FILL-IN, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TOGGLE-BOX
SENSITIVE
Logical
FRAME
SEPARATORS
Logical
BROWSER
SHARED
Logical
BROWSER, COMBO-BOX, EDITOR, FILL-IN, FRAME, RADIO-SET, SELECTION-LIST, SLIDER, TOGGLE-BOX
SIDE-LABELS
Logical
FRAME
SORT
Logical
COMBO-BOX, SELECTION-LIST
TITLE
Logical
BROWSER, FRAME
TITLE-BAR
Logical
BROWSER, FRAME
TITLE-BGCOLOR
Integer
FRAME
TITLE-FGCOLOR
Integer
FRAME
TOP-ONLY
Logical
FRAME
UNIQUE-MATCH
Logical
COMBO BOX
VIEW
Logical
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
VIEW-AS-TEXT
Logical
FILL-IN
VIRTUAL-HEIGHT
Integer
FRAME
VIRTUAL-HEIGHT-PIXELS
Integer
FRAME
VIRTUAL-WIDTH
Integer
FRAME
VIRTUAL-WIDTH-PIXELS
Integer
FRAME
WIDTH
Integer
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
WIDTH-PIXELS
Integer
BROWSER, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, SLIDER, TEXT, TOGGLE-BOX
WORD-WRAP
Logical
EDITOR

Table C–2: Settable attributes for custom widgets

Attribute
Data type
Allowed widgets
[SUP]1[/SUP]The RADIO-BUTTONS attribute represents the labels and values for the individual buttons in a set, arranged in a comma-separated list.The following example identifies this format: label, value, label, value, label, value, and so forth. One label/value pair is defined for each button identified in a set.


[h=5]Sample widget entry [/h] The following sample entry is in the src/template/progress.cst file:


*BUTTON Ne&xt
DESCRIPTION Simple Navigation Button
INHERIT C&ustom Size/Color
LABEL &Next
NAME Btn_Next
TRIGGER CHOOSE
DO:
&IF "{&PROCEDURE-TYPE}" EQ "SmartPanel" &THEN
&IF "{&ADM-VERSION}" EQ "ADM1.1" &THEN
RUN notify IN THIS-PROCEDURE ("get-next") NO-ERROR.
&ELSE
PUBLISH "fetchNext":U.
&ENDIF
&ELSEIF "{&TABLES-IN-QUERY-{&FRAME-NAME}}" NE "" &THEN
/*
** This is a simple NEXT RECORD navigation button, useful for building
** test screens quickly. NOTE: if there are no tables in the query,
** then this code will not compile’ so use the preprocessor to skip it.
*/
GET NEXT {&FRAME-NAME}.
IF NOT AVAILABLE {&FIRST-TABLE-IN-QUERY-{&FRAME-NAME}}
THEN GET LAST {&FRAME-NAME}.
IF AVAILABLE {&FIRST-TABLE-IN-QUERY-{&FRAME-NAME}} THEN DO:
DISPLAY {&FIELDS-IN-QUERY-{&FRAME-NAME}} WITH FRAME {&FRAME-NAME}.
{&OPEN-BROWSERS-IN-QUERY-{&FRAME-NAME}}
END.
&ENDIF
END TRIGGER



If you analyze this sample entry one section at a time, you can see how to write your own custom widget entry. In this example:

  • The first line specifies the widget type BUTTON and the display name for the widget:


    *BUTTON Ne&xt


    AppBuilder displays this name in the appropriate Object Palette menus. The ampersand (&) specifies that the “x” is the mnemonic on the Object Palette menu.
  • The second line describes the button’s functionality:


    DESCRIPTION Simple Navigation Button


    AppBuilder does nothing with this description. The description is meant as a summary for someone reading the custom object file.
  • The third line names another custom widget (Custom Size/Color) in the progress.cst file by using the widget’s display name:


    INHERIT C&ustom Size/Color


    The current widget (Next) inherits all of the attribute settings for the Custom Size/Color button. Where you place the INHERIT keyword affects how attributes are set. Later definitions override earlier definitions.
  • The fourth line specifies the label of the button:


    LABEL &Next


    The ampersand (&) specifies that “N” is the mnemonic for the button.
  • The fifth line specifies the widget name that AppBuilder uses internally to refer to the button:


    NAME Btn_Next



 
right got it working i can see how i can get my own selection box now. If i wanted it so a fill-in and selectionbox where created can i do that? what im trying to do is a create a search box underneath a fill-in box. So would be nice to have a normal fill-in with a selection box below it that can act as a search box. So when you drag my custom object onto to screen you get a fill-in box and a selection box
 
I don't think .... better is select your ojects in appbuilder and use the Export option, you can add internal procedures and functions.
save this file and when to want ... you can user the import option in appBuilder.
 
Ive Got a custom selection working on my appbuilder now... I've been trying to create a fill-in at the same time when i click the object by using

Code:
  RUN adeuib/_uib_crt.p
( INPUT ?,
  INPUT "fill-in" ,
  INPUT "SPECIAL:",
  INPUT 8.75 ,
  INPUT 57 ,
  INPUT 1.44 ,
  INPUT 12.50 ,
  OUTPUT intTest
) .


But I want a selection list and a fill-in created at the same time so i can link them togther via the private data. But if say im doing this using the "run" in a object e.g. selection list then I end up with 1 fill-in and 2 selection-lists. Is there anyway for me to stop an object being created if I've put something in its run statment?
 
Back
Top