#HEADER use app.utl use api_attr.nui Use Fdx_Attr.nui // FDX compatible attribute functions Use FdxSelct.utl // Functions iFdxSelectOneFile and iFdxSelectOneField Use SetOfFld.utl // cSetOfFields class #ENDHEADER class cBrowserThing is a cArray procedure construct_object integer img# forward send construct_object img# property integer piFile public 0 // Which FL entry? property integer piCurrentIndex public 0 // What is the current index that we are using property integer piSelectedFilelistEntry public 0 // property integer piNotifyObject public 0 // Which object should be notified when changes occur property string psSelectedRootname public "" object oSetOfFields is a cSetOfFields no_image end_object end_procedure procedure OnDisconnectTable end_procedure procedure DoSuspend end_procedure procedure DoReconnect end_procedure procedure DoConnectTable integer file# string rn# end_procedure procedure DisconnectTable integer file# close file# end_procedure procedure DoBrowserDataChanged local integer NotifyObject# get piNotifyObject to NotifyObject# if NotifyObject# send OnBrowserDataChanged to NotifyObject# end_procedure procedure DoDisconnect if (piFile(self)) begin close (piFile(self)) set piFile to 0 set psSelectedRootname to "" send CallBack_Files to (oSetOfFields(self)) msg_DisconnectTable self end send DoBrowserDataChanged end_procedure procedure DoSelectTableFileList local integer file# get piSelectedFilelistEntry to file# get iFdxSelectOneFile 0 file# to file# if file# begin send DoDisconnect set piSelectedFilelistEntry to file# send DoConnectTable file# "" send DoBrowserDataChanged end end_procedure procedure DoSelectTableBrowse end_procedure end_class class cBrowseList is a List procedure construct_object integer img# forward send construct_object img# property integer piFileNumber public 0 property integer piIndexNumber public 0 property integer piSelectedFilelistEntry public 0 object oBrowserThing is a cBrowserThing set piNotifyObject to (parent(self)) end_object set line_width to 2 0 on_key kFind_Next send request_find_next on_key kFind_Previous send request_find_previous on_key kBegin_of_Data send request_find_first on_key kEnd_of_Data send request_find_last end_procedure procedure OnBrowserDataChanged end_procedure procedure DoInitFile integer file# set piFileNumber to file# end_procedure procedure fill_values end_procedure procedure request_find.i integer mode# local integer file# get piFileNumber to file# if file# begin vfind (piFileNumber(self)) (piIndexNumber(self)) mode# send fill_values end end_procedure procedure request_find_next send request_find.i GT end_procedure procedure request_find_previous send request_find.i LT end_procedure procedure request_find_first clear (piFileNumber(self)) send request_find.i GT end_procedure procedure request_find_last clear (piFileNumber(self)) send request_find.i LT end_procedure procedure request_find_ge clear (piFileNumber(self)) send request_find.i GE end_procedure end_class // cBrowseList /oBrowse.Hdr ÚÄBrowse tableÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ /oBrowse.Frm ³ ³ ³ Table....: __________________________________________________________ ³ ³ Ordering.: __________________________________________________________ ³ ³ Idx value: __________________________________________________________ ³ ³ ³ /oBrowse.Record ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ____________________ ______________________________________________________ ³ ³ ³ /oBrowse.Btn ³____ ___ ___ ___ ____ _______ _______ ________ ______ ______ ________ _______³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ /* //  =   [Table] [Index] [Fields] [Edit] [Save] [Delete] [Close]³ object oBrowse_Vw is a app.Client oBrowse.Hdr action_bar (main_menu(self)) set location to 2 0 absolute object oFrm is a app.Form oBrowse.Frm set location to 1 0 relative on_key kenter send next on_key kprompt send prompt procedure prompt local integer ci# get current_item to ci# if ci# eq 0 send prompt_table if ci# eq 1 send prompt_index end_procedure item_list on_item "" send next set entry_state to false on_item "" send next set entry_state to false on_item "" send next set entry_state to false end_item_list set Item_Combo_Width item 1 to 60 procedure fill_index local integer file# index# segments# get piFileNumber to file# send Item_Combo_Delete_Data 1 send Item_Combo_Add_Item 1 "0: recnum" 0 for index# from 1 to 15 get API_AttrValue_INDEX DF_INDEX_NUMBER_SEGMENTS file# index# to segments# if segments# begin send Item_Combo_Add_Item 1 (string(index#)+": "+FDX_IndexAsFieldNames(0,file#,index#,0)) index# end loop end_procedure procedure OnComboChange integer itm# if itm# eq 0 send fill_index (Item_Combo_Current_Aux_Value(self,0)) if itm# eq 1 set piIndexNumber of (oLst(self)) to (Item_Combo_Current_Aux_Value(self,1)) end_procedure end_object object oLst is a cBrowseList oBrowse.Record set location to 6 0 relative end_object function piFileNumber returns integer function_return (piFileNumber(oLst(self))) end_function function piIndexNumber returns integer function_return (piIndexNumber(oLst(self))) end_function procedure prompt_table end_procedure procedure prompt_index end_procedure procedure prompt_fields end_procedure object oBtn is a app.Button oBrowse.Btn set location to 18 0 relative item_list on_item "" send request_find_first to (oLst(self)) on_item "" send request_find_previous to (oLst(self)) on_item "=" send request_find_ge to (oLst(self)) on_item "" send request_find_next to (oLst(self)) on_item "" send request_find_last to (oLst(self)) on_item "Table" send prompt_table on_item "Index" send prompt_index on_item "Fields" send prompt_fields on_item "Edit" send none on_item "Save" send none on_item "Delete" send none on_item "Close" send request_cancel end_item_list end_object end_object // oBrowse_Vw procedure Activate_Table_Browse send activate_scope to (oBrowse_Vw(self)) end_procedure // /oDisplayRecordBuffer.hdr // ÉÍDisplay record bufferÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» // /oDisplayRecordBuffer.frm // º º // º File.: ____________________________________________________________ º // º Index: ____________________________________________________________ º // º º // ºField name Value º // /oDisplayRecordBuffer.lst // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º_______________ _________________________________________________________ º // º º // /oDisplayRecordBuffer.btn // º ____ ___ ___ ___ ____ _______________ _____________ º // ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ // /* // object oDisplayRecordBuffer is a app.ModalClient oDisplayRecordBuffer.hdr // set location to 4 1 absolute // property integer piFileNumber public 0 // property integer piIndexNumber public 0 // object oFrm is a app.Form oDisplayRecordBuffer.frm // on_key kenter send next // set location to 1 0 relative // item_list // on_item "" send none // set entry_state to false // on_item "" send none // set entry_state to false // end_item_list // set Item_Combo_Width item 0 to 60 // set Item_Combo_Width item 1 to 60 // procedure initialize // local integer file# // send Item_Combo_Delete_Data 0 // move 0 to file# // repeat // get_attribute DF_FILE_NEXT_OPENED of file# to file# // if file# begin // send Item_Combo_Add_Item 0 (API_AttrValue_FILELIST(DF_FILE_ROOT_NAME,file#)) file# // end // until file# eq 0 // end_procedure // send initialize // procedure prepare_index // local integer file# index# segments# // get piFileNumber to file# // send Item_Combo_Delete_Data 1 // send Item_Combo_Add_Item 1 "0: recnum" 0 // for index# from 1 to 15 // get API_AttrValue_INDEX DF_INDEX_NUMBER_SEGMENTS file# index# to segments# // if segments# begin // send Item_Combo_Add_Item 1 (string(index#)+": "+FDX_IndexAsFieldNames(0,file#,index#,0)) index# // end // loop // end_procedure // procedure OnComboChange integer itm# // if itm# eq 0 send PrepareFile (Item_Combo_Current_Aux_Value(self,0)) // if itm# eq 1 set piIndexNumber to (Item_Combo_Current_Aux_Value(self,1)) // end_procedure // end_object // object oLst is a List oDisplayRecordBuffer.lst // set location to 6 0 relative // set line_width to 2 0 // on_key kFind_Next send request_find_next // on_key kFind_Previous send request_find_previous // on_key kBegin_of_Data send request_find_first // on_key kEnd_of_Data send request_find_last // procedure request_find.i integer mode# // vfind (piFileNumber(self)) (piIndexNumber(self)) mode# // send fill_values // end_procedure // procedure request_find_next // send request_find.i GT // end_procedure // procedure request_find_previous // send request_find.i LT // end_procedure // procedure request_find_first // clear (piFileNumber(self)) // send request_find.i GT // end_procedure // procedure request_find_last // clear (piFileNumber(self)) // send request_find.i LT // end_procedure // function sFieldValue.ii integer file# integer field# returns string // local integer type# len# dec# // local string rval# // get_field_value file# field# to rval# // if field# begin // move (API_AttrValue_FIELD(DF_FIELD_TYPE,file#,field#)) to type# // if type# eq DF_OVERLAP move "" to rval# // end // function_return rval# // end_function // procedure fill_values // local integer fld# max# file# // get piFileNumber to file# // move (API_AttrValue_FILE(DF_FILE_NUMBER_FIELDS,file#)) to max# // for fld# from 0 to max# // set value item (fld#*2+1) to (sFieldValue.ii(self,file#,fld#)) // loop // end_procedure // procedure prepare_list // local integer fld# max# file# // get piFileNumber to file# // send delete_data // move (API_AttrValue_FILE(DF_FILE_NUMBER_FIELDS,file#)) to max# // send add_item msg_none "RECNUM" // send add_item msg_none "" //(sFieldValue.ii(self,file#,0)) // for fld# from 1 to max# // send add_item msg_none (API_AttrValue_FIELD(DF_FIELD_NAME,file#,fld#)) // send add_item msg_none "" //(sFieldValue.ii(self,file#,fld#)) // loop // end_procedure // procedure request_find_ge // end_procedure // end_object // object oBtn is a app.Button oDisplayRecordBuffer.btn // set location to 17 0 relative // item_list // on_item "" send request_find_first to (oLst(self)) // on_item "" send request_find_previous to (oLst(self)) // on_item "=" send request_find_ge to (oLst(self)) // on_item "" send request_find_next to (oLst(self)) // on_item "" send request_find_last to (oLst(self)) // on_item "Select fields" send none // on_item "Close" send cancel // end_item_list // end_object // procedure PrepareFile integer file# // set piFileNumber to file# // send prepare_list to (oLst(self)) // send prepare_index to (oFrm(self)) // send Item_Combo_Make_Valid to (oFrm(self)) 1 // send fill_values to (oLst(self)) // end_procedure // procedure run.i integer file# // local integer grb# // send PrepareFile file# // set value of (oFrm(self)) item 0 to (API_AttrValue_FILELIST(DF_FILE_ROOT_NAME,file#)) // ui_accept self to grb# // end_procedure // end_object // oDisplayRecordBuffer // // //send run.i to (oDisplayRecordBuffer(self)) 4 // send activate_scope to (oBrowse_Vw(self)) // start_ui