//AB/ Project View Data Dialog //AB/ Object prj is a Dialog_Project //AB/ Set ProjectName to "View Data Dialog" //AB/ Set ProjectFileName to "ViewData.DG" //AB/ Set Size to 254 541 // Project Object Structure // oViewAllData is a cRDSModalPanel // oDynamicReadOnlyGrid is a cDynamicReadOnlyGrid // oFields_fm is a cRDSForm // oCurrentColumn_fm is a cRDSForm // oFieldType_fm is a cRDSForm // oFieldLength_fm is a cRDSForm // oFirst_bn is a cRDSButton // oNext_bn is a cRDSButton // oClose_bn is a cRDSButton // Register all objects Register_Object oClose_bn Register_Object oCurrentColumn_fm Register_Object oDynamicReadOnlyGrid Register_Object oFieldLength_fm Register_Object oFields_fm Register_Object oFieldType_fm Register_Object oFirst_bn Register_Object oNext_bn Register_Object oViewAllData //AB-IgnoreStart Use cRDSModalPanel.pkg Use cDynamicReadOnlyGrid.pkg Use cRDSForm.pkg Use cRDSButton.pkg //AB-IgnoreEnd Object oViewAllData Is A cRDSModalPanel //AB-StoreTopStart Property Handle phoGrid 0 Property Handle phoAutoAnsiCheck 0 Property String psCharacterFormat "" //AB-StoreTopEnd Set Border_Style To Border_Thick Set Minimize_Icon To False Set Maximize_Icon To True Set Icon To "RdsText.ico" Set Label To "View Data" Set Size To 223 501 Set piMinSize To 215 501 //AB-DDOStart //AB-DDOEnd Object oDynamicReadOnlyGrid Is A cDynamicReadOnlyGrid //AB-StoreTopStart Delegate Set phoGrid To Self //AB-StoreTopEnd Set Size To 171 485 Set Location To 7 6 Set Highlight_Row_state To True Set peAnchors To anAll Set Line_Width To 1 0 Set Form_Width Item 0 To 0 Set Header_Label Item 0 To "0" End_Object // oDynamicReadOnlyGrid Object oFields_fm Is A cRDSForm Set Label To "Column count:" Set Size To 13 27 Set Location To 183 57 Set Status_Help To "Number of fifelds/columns for the table that is of the type(s) inidcated in the header" Set peAnchors To anBottomLeft Set Label_Col_Offset To 2 Set Label_Justification_Mode To jMode_Right //AB-StoreStart Set Enabled_State To False //AB-StoreEnd End_Object // oFields_fm Object oCurrentColumn_fm Is A cRDSForm Set Label To "Current column:" Set Size To 13 27 Set Location To 183 141 Set peAnchors To anBottomLeft Set Label_Col_Offset To 2 Set Label_Justification_Mode To jMode_Right //AB-StoreStart Set Enabled_State To False //AB-StoreEnd End_Object // oCurrentColumn_fm Object oFieldType_fm Is A cRDSForm Set Label To "Type:" Set Size To 13 42 Set Location To 183 191 Set Status_Help To "The field/column type" Set peAnchors To anBottomLeft Set Label_Col_Offset To 2 Set Label_Justification_Mode To jMode_Right //AB-StoreStart Set Enabled_State To False //AB-StoreEnd End_Object // oFieldType_fm Object oFieldLength_fm Is A cRDSForm Set Label To "Length:" Set Size To 13 27 Set Location To 183 264 Set Status_Help To "The field/column lenght and precision" Set peAnchors To anBottomLeft Set Label_Col_Offset To 2 Set Label_Justification_Mode To jMode_Right //AB-StoreStart Set Enabled_State To False //AB-StoreEnd End_Object // oFieldLength_fm Object oFirst_bn Is A cRDSButton Set Label To "&First set of data" Set Size To 14 55 Set Location To 183 331 Set Status_Help To "Display from beginning of data (PgUp)" Set peAnchors To anBottomRight //AB-StoreStart Procedure OnClick Handle ho Delegate Get phoGrid To ho If ho Send FirstSet Of ho End_Procedure // OnClick On_Key Key_F6 Send Switch On_Key Key_Shift+Key_F6 Send Switch_Back //AB-StoreEnd End_Object // oFirst_bn Object oNext_bn Is A cRDSButton Set Label To "&Next set of data" Set Size To 14 55 Set Location To 183 389 Set Status_Help To "View next set of data (PgDn)" Set peAnchors To anBottomRight Set Default_State To True //AB-StoreStart Procedure OnClick Handle ho Delegate Get phoGrid To ho If ho Send NextSet Of ho End_Procedure // OnClick On_Key Key_F6 Send Switch On_Key Key_Shift+Key_F6 Send Switch_Back On_Key kCancel Send KeyAction Of oClose_bn //AB-StoreEnd End_Object // oNext_bn Object oClose_bn Is A cRDSButton Set Label To "&Close" Set Size To 14 45 Set Location To 183 447 Set Status_Help To "Close panel" Set peAnchors To anBottomRight //AB-StoreStart Procedure OnClick Send Close_Panel // Augmented in panel object End_Procedure On_Key Key_F6 Send Switch On_Key Key_Shift+Key_F6 Send Switch_Back //AB-StoreEnd End_Object // oClose_bn //AB-StoreStart Set Locate_Mode To Center_On_Screen Set Extended_Window_Style To WS_EX_TOOLWINDOW False Set Extended_Window_Style To WS_EX_DLGMODALFRAME True Function InitGrid Integer iFile Boolean bMultiType Integer iItem String sTable Returns Integer Handle ho Integer iColCount String sText sDriver Set Label To ("View Data for data table:" * String(sTable)) Get phoGrid To ho Set piFile Of ho To iFile Set pbMultiType Of ho To bMultiType Get_Attribute DF_FILE_DRIVER Of iFile To sDriver If (sDriver = FLEX_DRV_ID) Set piPaintCol Of ho To iItem Else If (sDriver = DFBTRDRV_ID) Set piPaintCol Of ho To (iItem - 2) Else Set piPaintCol Of ho To (iItem - 1) Set Default_State Of oNext_bn To (piPaintCol(ho) < 0) Get CreateColumns Of ho To iColCount If Not iColCount Begin Send StopWorkingMessage If (Err) Move "There is no index defined for this data table. Cannot view data." To sText Else Begin If bMultiType Move "Sorry, could not find any fields of type ASCII, Numeric, or Date for this table." To sText Else Move "Sorry, there are no fields of type ASCII for this table." To sText End // Else Begin Send Info_Box sText Function_Return 1 End // If Not iColCount Begin Send DoFillData Of ho If (sDriver = FLEX_DRV_ID) Decrement iColCount Set Value Of oFields_fm To iColCount Function_Return 0 End_Function // InitGrid Procedure Close_Panel Handle ho Integer iFile iMode String sDriver Get phoGrid To ho Set piPaintCol Of ho To -1 Get piFile Of ho To iFile Set pbFirstAnsi Of ho To True Set pbMultiType Of ho To False Set pbAnsi Of ho To False Get_Attribute DF_FILE_DRIVER Of iFile To sDriver // This resets the ANSI/OEM value if changed, to files original state: If (pbMultiType(ho) And (C_CKDrivers Contains sDriver)) ; Set_Attribute DF_FILE_TABLE_CHARACTER_FORMAT Of iFile To (psCharacterFormat(ho)) // Do _not_ save size if viewmode_zoom! Get View_Mode To iMode If (iMode = ViewMode_Zoom) Set View_Mode To ViewMode_Normal Forward Send Close_Panel End_Procedure // Close_Panel Function Item_Count Returns Integer End_Function // Item_Count On_Key Key_Alt+Key_N Send KeyAction Of oNext_bn On_Key Key_Alt+Key_F Send KeyAction Of oFirst_bn On_Key Key_Alt+Key_C Send KeyAction Of oClose_bn On_Key kCancel Send KeyAction Of oClose_bn //AB-StoreEnd End_Object // oViewAllData //AB-StoreStart Procedure DoStartViewData Integer iFile Integer iState Boolean bMultiType Integer iItem String sTable Returns String Handle ho hoGrid Boolean bIsOpen Integer iField iRetval String sDriver sText sCharacterFormat sValue Move (oViewAllData(Self)) To ho If iFile Get_Attribute DF_FILE_OPENED Of iFile To bIsOpen If Not bIsOpen Begin Send Info_Box "The table is not open. Can't view data." Procedure_Return End // If Not bIsOpen Begin Send StartWorkingMessage "Initializing Data View..." Get_Attribute DF_FILE_DRIVER Of iFile To sDriver If (bMultiType And (C_CKDrivers Contains sDriver) And sDriver <> DFBTRDRV_ID) Begin // C_CKDrivers is a constant in SyncFuncs.pkg Send Ignore_Error Of Error_Info_Object 4285 Indicate Err False Get_Attribute DF_FILE_TABLE_CHARACTER_FORMAT Of iFile To sCharacterFormat If Not (Err) Begin Set psCharacterFormat Of ho To sCharacterFormat Set_Attribute DF_FILE_TABLE_CHARACTER_FORMAT Of iFile To (If(iState = 1, "ANSI", "OEM")) End // If Not (Err) Begin Send Trap_Error Of Error_Info_Object 4285 End Get phoGrid Of ho To hoGrid If (sDriver = FLEX_DRV_ID Or sDriver = DFBTRDRV_ID) Set piIndex Of hoGrid To 0 If (C_CKDrivers Contains sDriver And sDriver <> DFBTRDRV_ID) Begin Send DoSetPrimaryIndex Of hoGrid iFile // Class procedure. End // If (C_CKDrivers Contains sDriver And sDriver <> DFBTRDRV_ID) Begin Else If (sDriver = DFBTRDRV_ID And iItem <> -1) Move (iItem + 1) To iItem Get InitGrid Of ho iFile bMultiType iItem sTable To iRetval If iRetval Begin Send StopWorkingMessage Procedure_Return End // If iRetval Begin Set psMoveValueOut Of hoGrid To "" Send StopWorkingMessage Send Popup_Modal Of ho // POPUP dialog Get psMoveValueOut Of hoGrid To sValue If (Length(sValue) > 0) Procedure_Return sValue Else Procedure_Return "" End_Procedure // DoStartViewData //AB-StoreEnd //AB/ End_Object // prj