//**************************************************************************** // $Module type: CLASS // $Module name: cCheckboxColumnGrid // $Author : VINCENT // Created : 11/06/99 @ 4:22 // // Description // This class makes it possible to create a grid in which one column (user // definable) shows a checkbox to indicate whether the current row is // considered selected or not. // // $Rev History // 11/06/99 VINCENT Module header created //**************************************************************************** Use cTooltip.pkg Class cCheckboxColumnGrid Is A Grid //**************************************************************************** // $Module type: PROCEDURE // $Module name: Construct_Object // $Author : VINCENT // Created : 11/06/99 @ 4:24 // // Description // Create a property to store the checkbox column number in. This will make // it possible to toggle the checkbox from true to false and vice-versa // when the user clicks anywhere in the row. The value will be -1 to // avoid that the toggle_select message is send with a item which is not // a checkbox item. // // The default will be two columns in the grid, most likely at least two. // The select_mode is set to multi_select to be able to select more than // one line. The scroll_bar_visible_state is set to false because this kind // of lists usually do not have so many items. Developers can set the // property to true. Because this kind of grids do have usually fixed item // value texts to display the resize_column_state is default false. // // The values in this class reflect the settings in the DFC and DFO. // // $Rev History // 11/06/99 VINCENT Module header created //**************************************************************************** Register_Object oToolbar Register_Procedure Set phoCopy Handle ho Register_Procedure Set phoPaste Handle ho Register_Procedure Set phoCut Handle ho Procedure Construct_Object Forward Send Construct_Object Property Integer piCheckboxColumn 0 Property Integer piCheckboxColumn2 3 Property Handle Private.phoToolTip 0 Object oTooltip Is A cTooltip Set Private.phoToolTip To (Self) End_Object // oTooltip Set Line_Width To 2 0 Set Resize_Column_State To False // Set Scroll_Bar_Visible_State To False Set Select_Mode To Multi_Select Set Oem_Translate_State to False Set Entry_msg to DoDisableToolbarButtons Set Exit_msg to DoEnableToolbarButtons End_Procedure // Construct_Object Procedure End_Construct_Object Handle ho String sHelp Boolean bVisible bPopup Forward Send End_Construct_Object Get Private.phoToolTip To ho Get Visible_State To bVisible If (ho > 0 And bVisible = True) Begin Delegate Get Popup_State To bPopup // If (bPopup = False) Send Activate Of ho Send Activate Of ho End // If (ho > 0 And bVisible = True) Begin End_Procedure // End_Construct_Object Procedure DoEnableToolbarButtons Handle ho Move (oToolBar(Self)) to ho If ho Begin Get phoCut To ho If ho Set pbEnabled Of ho To True Get phoCopy To ho If ho Set pbEnabled Of ho To True Get phoPaste To ho If ho Set pbEnabled Of ho To True End // If ho Begin End_Procedure // DoEnableToolbarButtons Procedure DoDisableToolbarButtons Handle ho Move (oToolBar(Self)) to ho If ho Begin Get phoCut To ho If ho Set pbEnabled Of ho To False Get phoCopy To ho If ho Set pbEnabled Of ho To False Get phoPaste To ho If ho Set pbEnabled Of ho To False End // If ho Begin End_Procedure // DoDisableToolbarButtons Procedure Page Integer iFlag Handle ho hWnd String sHelp Boolean bVisible bPopup Forward Send Page iFlag Get Private.phoToolTip To ho Get Visible_State To bVisible If (ho And bVisible) Begin Get Status_Help Item 0 To sHelp Set psTooltip Of ho To (ToAnsi(sHelp)) Get Window_Handle To hWnd If (iFlag And ho > 0 And hWnd > 0) Send AddTool Of ho hWnd End // If (ho And bVisible) Begin End_Procedure // Page //**************************************************************************** // $Module type: PROCEDURE // $Module name: DoAddCheckboxItem // $Author : VOO // Created : 15-09-96 @ 13:25 // // Description // This procedure will add an item to the grid but will tell the grid to // show the item as checkbox and show selected or not. // // $Rev History // 15-09-96 Module header created //**************************************************************************** Procedure DoAddCheckboxItem Local Integer iItem Send Add_Item Msg_None "" Move (Item_Count(Self) - 1) To iItem Set Checkbox_Item_State Item iItem To True End_Procedure // DoAddCheckboxItem //**************************************************************************** // $Module type: PROCEDURE // $Module name: DoAddTextItem // $Author : VOO // Created : 03-11-99 @ 21:10 // // Description // After adding an item we will make that the item cannot be changed. // // $Rev History // 03-11-99 Module header created //**************************************************************************** Procedure DoAddTextItem String sValue Local Integer iItem Send Add_Item Msg_None sValue Move (Item_Count(Self) - 1) To iItem Set Entry_State Item iItem To False End_Procedure // DoAddTextItem //**************************************************************************** // $Module type: PROCEDURE // $Module name: Select_Toggling // $Author : VINCENT // Created : 09/08/98 @ 09:35 // // Description // This method was augmented to allow user to click on the checkbox or at // the text. Both will toggle the select_state. // // $Rev History // 09/08/98 VINCENT Module header created // 11/10/99 WVA typo corrected //**************************************************************************** // 2002-08-30 ------------------------------------ Start Nils G. Svedmyr // Procedure logic moved to class cSyncTableCheckboxGrid: // Procedure Select_Toggling Integer iItem Integer bState // Local Integer iColumns iCheckboxColumn // If iItem Eq Current Begin // Get Current_Item To iItem // End // Get piCheckboxColumn To iCheckboxColumn // If iCheckboxColumn Ge 0 Begin // Move (Low (Matrix_Size (Self))) To iColumns // If (Mod (iItem, iColumns)) Eq iCheckboxColumn Begin // Forward Send Select_Toggling iItem bState // End // Else Begin // Forward Send Select_Toggling (Integer (iItem / iColumns) * iColumns) bState // End // End // End_Procedure // Select_Toggling // 2002-08-30 ------------------------------------ Stop Nils G. Svedmyr End_Class // cCheckboxColumnGrid