Use Windows.pkg Use DFClient.pkg Use cReportControlGrid.pkg Use Master.DD Use CodeMast.DD Use Settings.DD Use cReportControlGridColumn.pkg // Helper function for Dynamic_Quiz_Subject & Dynamic_Quiz_Level below. Function Dynamic_Quiz_SubLev Global String sType String sCode Returns String String sDesc If (Length(sCode) = 0) Procedure_Return Clear Codemast Move (Trim(sType)) to Codemast.Type Move (Trim(sCode)) to Codemast.Code Find Eq Codemast.Code If (Settings.LangModeOutput = 0) ; Move Codemast.Description to sDesc Else Move Codemast.Description2 to sDesc Function_Return (Trim(sDesc)) End_Function // Dynamic_Quiz_SubLev Function Dynamic_Quiz_Subject Global Returns String String sDesc Get Dynamic_Quiz_SubLev "QUIZTYPE" Master.Subject to sDesc Function_Return sDesc End_Function // Dynamic_Quiz_Subject Function Dynamic_Quiz_Level Global Returns String String sCode sDesc Get Dynamic_Quiz_SubLev "QUIZLEVEL" Master.Level to sDesc Function_Return sDesc End_Function // Dynamic_Quiz_Level Deferred_View Activate_oReportControlWithDataTest for ; Object oReportControlWithDataTest is a dbView Property Handle phoReportControl Object oMaster_DD is a Master_DataDictionary End_Object Set Main_DD to oMaster_DD Set Server to oMaster_DD Set Size to 449 711 Set Location to 2 51 Set Label to "ReportControlGrid Data Test" Set Border_Style to Border_Thick Set Maximize_Icon to True Object oReportControlGridData is a cReportControlGrid Delegate Set phoReportControl to Self Set Size to 433 582 Set Location to 13 13 Set piHeaderStyle to OLExtpColumnOffice2003 Set peAnchors to anAll Set Border_Style to OLExtpBorderFrame Set piCustomDraw to OLExtpCustomBeforeDrawRow Set Color to 13303806 Set TextColor to clNavy Set pbEditOnClick to False Set pbAllowColumnRemove to True Set piReportGridStyle to OLExtpGridSmallDots Set pbDrawGridForEmptySpace to False Set pbAutoColumnSizing to True Procedure OnCreateGrid Send AddIcons Send AddColumns Send FillGrid End_Procedure // OnCreateGrid Procedure AddIcons End_Procedure // AddIcons Procedure AddColumns Handle hColumn Integer iRetval Get AddColumn "ID" to hColumn Set HeaderWidth item hColumn to 40 Set FooterLabel item hColumn to "Footer 1" Set ColumnNumericState item hColumn to True Set ColumnEditControlStyle item hColumn to RC_Numeric // Doesn't work! Get AddColumn "Question" to hColumn Set HeaderWidth item hColumn to 260 Set ColumnJustificationMode item hColumn to OLExtpAlignmentWordBreak Set ColumnWordbreakState item hColumn to True // Shouldn't be necessary (ColumnJustificationMode should set this automatically), but it doesn't quite work. Get AddColumn "Answer" to hColumn Set HeaderWidth item hColumn to 160 Set ColumnJustificationMode item hColumn to OLExtpAlignmentWordBreak Set ColumnWordbreakState item hColumn to True // Shouldn't be necessary (ColumnJustificationMode should set this automatically), but it doesn't quite work. Get AddColumn "Subject" to hColumn Set HeaderWidth item hColumn to 135 Set ColumnComboState item hColumn to True Set ColumnComboListObject item hColumn to (Master_Type_VT(Self)) True Get AddColumn "Level" to hColumn Set HeaderWidth item hColumn to 105 Set ColumnShadowState item hColumn to True Get AddColumn "Created" to hColumn Set HeaderWidth item hColumn to 80 Get AddColumn "Date Used" to hColumn Set HeaderWidth item hColumn to 80 End_Procedure // AddColumns Procedure FillGrid Handle hItem Integer i iItem String sValue Send Cursor_Wait of Cursor_Control Clear Master Find GT Master.ID Repeat Get AddItem Master.ID to hItem Set pbBold item hItem to True Get AddItem Master.Question to hItem Get AddItem Master.Answer to hItem Get AddItem (Dynamic_Quiz_Subject()) to hItem // Global function defiend at top of view. Get AddItem (Dynamic_Quiz_Level()) to hItem // Global function defiend at top of view. Get AddItem Master.Created to hItem Get AddItem Master.Date_Used to hItem Find GT Master.ID Until (not(Found)) // Don't forget to send Populate when done! Else the grid content will not be visible! Send Populate Send Cursor_Ready of Cursor_Control End_Procedure // FillGrid End_Object // oReportControlGridData Object oDeleteAll_bn is a Button Set Size to 14 72 Set Location to 13 602 Set Label to "Send DeleteData" Set peAnchors to anTopRight Set MultiLineState to True Set Typeface to "Tahoma" Set FontSize to 14 0 Procedure OnClick Handle hoReportGrid Integer iRow iCurrent Get phoReportControl to hoReportGrid Get CurrentRow of hoReportGrid to iRow Get CurrentItem of hoReportGrid to iCurrent Send DeleteData to hoReportGrid Send Info_Box ("The current row was:" * String(iRow) * "(zero based, a value of -1 means that the grid was empty.)" * "\nThe current item was" * String(iCurrent)) End_Procedure // OnClick End_Object // oDeleteAll_bn Object oFillGrid_bn is a Button Set Size to 14 72 Set Location to 29 602 Set Label to "Send FillGrid" Set peAnchors to anTopRight Set MultiLineState to True Set Typeface to "Tahoma" Set FontSize to 14 0 Procedure OnClick Handle hoReportGrid Integer iItems iRows iCols iRetval DateTime dtStart dtEnd TimeSpan tsTime Get phoReportControl to hoReportGrid Get ItemCount of hoReportGrid to iItems Get RowCount of hoReportGrid to iRows If (iItems > 0) Begin Send Info_Box ("The grid contains" * String(iItems) * "items/cells in" * String(iRows) * "rows. Please Delete data first.") Procedure_Return End Get Col_Count of hoReportGrid to iCols If (iCols = 0) Begin Move (CurrentDateTime()) to dtStart Send AddColumns to hoReportGrid End Else Begin Move (CurrentDateTime()) to dtStart End Send FillGrid to hoReportGrid Move (CurrentDateTime()) to dtEnd Move (dtEnd - dtStart) to tsTime Get ItemCount of hoReportGrid to iItems Get RowCount of hoReportGrid to iRows Send Info_Box ("The grid was filled with" * String(iItems) * "items/cells in" * String(iRows) * "rows in" * String((SpanSeconds(tsTime))) +"," + ; String((SpanMilliseconds(tsTime))) * "seconds.\n\nNote that functions were used (find of related records) to fill column 4 and 5.\nIt slowed down performance by approximately 30%.") End_Procedure // OnClick End_Object // oFillGrid_bn Object oClickEditInfo_tb is a TextBox Set Auto_Size_State to False Set Size to 65 63 Set Location to 59 602 Set Label to "Note: pbEditOnClick is False which means you have to double-click on an item to be able to edit it." Set Justification_Mode to JMode_Left Set peAnchors to anTopRight Set Typeface to "Tahoma" Set FontSize to 14 0 Set FontWeight to 700 End_Object Object oTypeface_cf is a cNoChangeUpstartComboForm Set Size to 16 100 Set Location to 136 602 Set Label to "Typeface" Set Label_Col_Offset to 0 Set Label_Justification_Mode to JMode_Top Set peAnchors to anTopRight Set Typeface to "Tahoma" Set FontSize to 14 0 Procedure Combo_Fill_List Send Combo_Add_Item "RC_DefaultTypeface" Send Combo_Add_Item "Tahoma" Send Combo_Add_Item "Arial" Send Combo_Add_Item "MS Sans Serif" Set Value to "RC_DefaultTypeface" // Default value. End_Procedure Procedure OnChange String sValue Get Value to sValue Set Typeface of (phoReportControl(Self)) to sValue End_Procedure End_Object Object oFontSize_cf is a cNoChangeUpstartComboForm Set Size to 16 100 Set Location to 167 602 Set Label to "FontSize" Set Label_Col_Offset to 0 Set Label_Justification_Mode to JMode_Top Set peAnchors to anTopRight Set Typeface to "Tahoma" Set FontSize to 14 0 Procedure Combo_Fill_List Send Combo_Add_Item "RC_DefaultFontSize" Send Combo_Add_Item "7" Send Combo_Add_Item "8" Send Combo_Add_Item "9" Send Combo_Add_Item "10" Send Combo_Add_Item "11" Send Combo_Add_Item "12" Set Value to "RC_DefaultFontSize" // Default value. End_Procedure Procedure OnChange String sValue Get Value to sValue Set FontSize of (phoReportControl(Self)) to (Eval(sValue)) End_Procedure End_Object Cd_End_Object // oReportControlWithDataTest