Dcbrowse with Edit

This forum is for eXpress++ general support.
Post Reply
Message
Author
omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

Dcbrowse with Edit

#1 Post by omni »

Roger,

Do you have a sample of a dcbrowse where a user can update only a couple of fields? I have just never done one and was looking for a sample, but could not find one.
We want to display the detail of the file, but the user needs to update the date/time for each record. Working directly from the file, all fields.

Fred
Omni

User avatar
RDalzell
Posts: 205
Joined: Thu Jan 28, 2010 6:57 am
Location: Alsip, Illinois USA

Re: Dcbrowse with Edit

#2 Post by RDalzell »

Fred,

From Roger's XDemo XSample_10

Code: Select all

FUNCTION XSample_10

/*
CELL-EDITING in a BROWSE

This example shows how to enable editing of data within the
cells of the browse display.  The EDITOR clause of the
DCBROWSECOL command defines the ID of the object to use as
the cell-editor.

*/

LOCAL GetList := {}, oBrowse, oBrowBox, oMsgBox, aType, xNIL

USE COLLECT VIA DBFNTX NEW SHARED
DC_GetPopUpCaption({nil,BITMAP_PICKLIST,0})

@  2,2 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 78,12 ;
   OBJECT oBrowBox

@ .1,.5 DCBROWSE oBrowse PARENT oBrowBox ALIAS 'COLLECT' ;
   SIZE 77,11.8 ;
   FREEZELEFT { 1 } ;
   EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITACROSSDOWN ;
   DELETE xbeK_DEL ;
   INSERT xbeK_INS ;
   PRESENTATION DC_BrowPres()

DCBROWSECOL FIELD COLLECT->descrip ;
  WIDTH 8 ;
  MESSAGE 'This is the description of the article' ;
  HEADER "Description" PARENT oBrowse

DCBROWSECOL FIELD COLLECT->type ;
  WIDTH 6 ;
  MESSAGE 'This is the Type-Class of the article' ;
  HEADER "Type" PARENT oBrowse ;
  EDITOR 'TYPE'

DCBROWSECOL FIELD COLLECT->date_orig ;
  HEADER "Orig Date" PARENT oBrowse ;
  MESSAGE 'This is the date the article was created or discovered' ;
  WIDTH 6 ;
  EDITOR 'ORIGINAL_DATE'

DCBROWSECOL FIELD COLLECT->date_acqu ;
  HEADER "Acqu Date" PARENT oBrowse ;
  MESSAGE 'This is the date the article was acquired' ;
  WIDTH 6 ;
  EDITOR 'ACQUIRED_DATE'

DCBROWSECOL FIELD COLLECT->orig_price ;
  HEADER "Acqu Price" PARENT oBrowse ;
  MESSAGE 'This is the original price paid for the article' ;
  WIDTH 6 ;
  EDITOR 'ORIGINAL_PRICE'

DCBROWSECOL FIELD COLLECT->appr_value ;
  HEADER "Appr Value" PARENT oBrowse ;
  MESSAGE 'This is the current appraised value of the article' ;
  WIDTH 6 ;
  EDITOR 'APPRAISED_VALUE'

DCBROWSECOL FIELD COLLECT->memo ;
  HEADER "Memo" PARENT oBrowse ;
  MESSAGE 'This is general info about how the article was acquired' ;
  WIDTH 24 ;
  EDITOR 'BROWSEEDIT_MEMO' EXITKEY xbeK_F10

aType := { 'HollyWood','Sports','Star-Trek','Comics','Books','Other' }

@  nil, nil DCCOMBOBOX xNIL LIST aType SIZE 12,6 ;
   TYPE XBPCOMBO_DROPDOWN ;
   MESSAGE 'Enter the TYPE of article' ;
   ID 'TYPE'

@  nil,nil DCMULTILINE xNIL SIZE 20,5 ;
   FONT "10.Courier" ;
   MESSAGE 'Press the F10 Key to Exit and Save' ;
   ID 'BROWSEEDIT_MEMO'

@  nil, nil DCGET xNIL PICT '99/99/9999' ;
   POPUP {|d|DC_PopDate(d,,,,,,2)} ;
   VALID {|o,x,d|d:=o:get:varGet(),x:=d>Date(),iif(x,DC_WinAlert('Bad date'),nil),!x} ;
   MESSAGE 'Enter the Date that article was created or discovered' ;
   GETID 'ORIGINAL_DATE'

@  nil, nil DCGET xNIL PICT '99/99/9999' ;
   POPUP {|d|DC_PopDate(d,,,,,,2)} ;
   VALID {|o,x,d|d:=o:get:varGet(),x:=d>Date(),iif(x,DC_WinAlert('Bad date'),nil),!x} ;
   MESSAGE 'Enter the Date that article was acquired' ;
   GETID 'ACQUIRED_DATE'

/*
@  nil, nil DCGET xNIL PICT '@K 9999.99'  ;
   POPUP {|n|DC_PopCalc(n)} ;
   MESSAGE 'Enter the Price paid for article' ;
   GETID 'ORIGINAL_PRICE'
*/

@  nil, nil DCSPINBUTTON xNIL SIZE 10,22 ID 'ORIGINAL_PRICE' LIMITS 1,5 PIXEL

@  nil, nil DCGET xNIL PICT '@K 9999.99'  ;
   POPUP {|n|DC_PopCalc(n)} ;
   MESSAGE 'Enter the Current appraised value of article' ;
   GETID 'APPRAISED_VALUE'

@  15,2 DCMESSAGEBOX OBJECT oMsgBox SIZE 78,1.2 ;
   FONT '12.Helv'

DCREAD GUI ;
   FIT ;
   MODAL ;
   BUTTONS DCGUI_BUTTON_EXIT ;
   TITLE 'Example of Browse Cell-Editing (double-click on a cell)'

IF Flock()
  CLOSE
ENDIF

RETURN nil

Post Reply