//============================================================================= // Project : SigCj - VDF Classes for Codejock // File : SigCjCalendar_Reorder.dg // Description : VDF Class for Codejock control // // Revision : $Rev: $ // $Date: $ // $Author: $ // // Requirements : Visual DataFlex 14.1+ // Codejock SuitePro - Version 13.4.0+ // // Copyright : Copyright © 2009-2012 VDF SIG UK, All rights reserved. // Visual DataFlex Special Interest Group UK. // http://www.vdfsig.co.uk/ // // This file is part of SigCj. // // SigCj is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation, either version // 2.1 of the License, or (at your option) any later version. // // SigCj is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // If you have the complete SigCj workspace then a copy of the // GNU Lesser General Public License is in the Docs folder. If // not, see . // //============================================================================= Use Windows.pkg Use cCJGrid.pkg Use cCJGridColumn.pkg Use cSigCjPushButton.pkg Use cSigCjCalendar_Public.pkg Object oSigCjCalendar_Reorder_Panel is a ModalPanel Set Size to 146 136 Set Label to "Reorder Resources" Set piMinSize to 89 117 Set Location to 2 2 Set Border_Style to Border_Thick Property tdSigCjCal_Resource[] ptaResources Property Integer[] piaIDs Object oResources is a cCJGrid Set Size to 117 100 Set Location to 6 7 Set pbFocusSubItems to False Set pbSelectionEnable to True Set pbReadOnly to True Object oName is a cCJGridColumn Set piWidth to 106 Set psCaption to "Name" End_Object Object oID is a cCJGridColumn Set piWidth to 44 Set psCaption to "ID" End_Object Procedure Activating Send LoadData End_Procedure Procedure LoadData Integer iCount iLoop tDataSourceRow[] tData tdSigCjCal_Resource[] taResources Get ptaResources to taResources Move (SizeOfArray(taResources) - 1) to iCount For iLoop from 0 to iCount Move taResources[iLoop].sName to tData[iLoop].sValue[0] Move taResources[iLoop].iID to tData[iLoop].sValue[1] Loop Send InitializeData tData End_Procedure Procedure RetriveNewOrder Integer iCount iLoop Integer[] iaOrder tDataSourceRow[] tData Get DataSource of (phoDataSource(Self)) to tData Move (SizeOfArray(tData) - 1) to iCount For iLoop from 0 to iCount Move tData[iLoop].sValue[1] to iaOrder[SizeOfArray(iaOrder)] Loop Set piaIDs to iaOrder End_Function Procedure Move_Up Integer iRow tDataSourceRow[] tData tDataSourceRow tRow Get DataSource of (phoDataSource(Self)) to tData Get piSelectedRow of (phoDataSource(Self)) to iRow If (iRow > 0) Begin Move tData[iRow] to tRow Move (RemoveFromArray(tData, iRow)) to tData Move (InsertInArray(tData, (iRow - 1), tRow)) to tData Send InitializeData tData Send MoveToRow (iRow - 1) True End End_Procedure Procedure Move_Down Integer iRow tDataSourceRow[] tData tDataSourceRow tRow Get DataSource of (phoDataSource(Self)) to tData Get piSelectedRow of (phoDataSource(Self)) to iRow If (iRow < (SizeOfArray(tData) - 1)) Begin Move tData[iRow] to tRow Move (RemoveFromArray(tData, iRow)) to tData If ((iRow + 1) <> SizeOfArray(tData)) Begin Move (InsertInArray(tData, (iRow + 1), tRow)) to tData End Else Begin Move tRow to tData[SizeOfArray(tData)] End Send InitializeData tData Send MoveToRow (iRow + 1) True End End_Procedure End_Object Object oUp is a cSigCJPushButton Set Size to 18 18 Set Location to 41 113 Set psImage to "Up2.ico" Set piBorderGap to 1 Set piImageGap to 1 Set pbFlatStyle to True Set pbPointer_Only to True Procedure OnComClick Forward Send OnComClick Send Move_Up of oResources End_Procedure End_Object Object oDown is a cSigCJPushButton Set Size to 18 18 Set Location to 71 113 Set psImage to "Down2.ico" Set piBorderGap to 1 Set piImageGap to 1 Set pbFlatStyle to True Set pbPointer_Only to True Procedure OnComClick Forward Send OnComClick Send Move_Down of oResources End_Procedure End_Object Object oOK_Btn is a Button Set Label to "&OK" Set Location to 128 27 Set peAnchors To anBottomRight Procedure OnClick Send RetriveNewOrder of oResources Send Close_Panel End_Procedure End_Object Object oCancel_Btn is a Button Set Label to "&Cancel" Set Location to 128 82 Set peAnchors to anBottomRight Procedure OnClick Send Close_Panel End_Procedure End_Object On_Key Key_Alt+Key_O Send KeyAction of oOK_Btn On_Key Key_Alt+Key_C Send KeyAction of oCancel_Btn Function Show_Dialog tdSigCjCal_Resource[] taResources Returns Integer[] Set ptaResources to taResources Send Popup Function_Return (piaIDs(Self)) End_Function End_Object