Module cSigCJPropEx_Mixin.pkg
1//==============================================================================
2// Project : SigCj - VDF Classes for Codejock
3// File : cSigCJPropEx_Mixin.pkg
4// Description : VDF Class mixin for Codejock Property Exchange class
5//
6// Revision : $Rev: 599 $
7// $Date: 2009-10-14 05:39:01 -0400 (Wed, 14 Oct 2009) $
8// $Author: pak $ Martin Pincott
9//
10// Requirements : Visual DataFlex 12.1+
11// Codejock SuitePro - Version 12.0.0+
12//
13// Copyright : (c) 2008 VDF SIG UK
14// Visual DataFlex Special Interest Group UK.
15// http://www.vdfsig.co.uk/
16// dev@vdfsig.co.uk
17//
18// This file is part of SigCj.
19//
20// SigCj is free software: you can redistribute it and/or modify
21// it under the terms of the GNU Lesser General Public License
22// as published by the Free Software Foundation, either version
23// 2.1 of the License, or (at your option) any later version.
24//
25// SigCj is distributed in the hope that it will be useful, but
26// WITHOUT ANY WARRANTY; without even the implied warranty of
27// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28// GNU Lesser General Public License for more details.
29//
30// If you have the complete SigCj workspace then a copy of the
31// GNU Lesser General Public License is in the Docs folder. If
32// not, see <http://www.gnu.org/licenses/>.
33//
34//==============================================================================
35
36Use VDFBase.pkg
37
38Class cSigCJPropEx_Mixin is a Mixin
39
40 // Initialise, create properties etc
41 Procedure Initialise_PropEx_Mixin
42
43 { Category="CodeJock" InitialValue=True }
44 Property Boolean pbPX_Delete_OnNoSave True
45
46 { Category="CodeJock" }
47 Property Boolean pbPX_Save_Layout False
48
49 { Category="CodeJock" }
50 Property String psPX_Class ""
51
52 { Category="CodeJock" }
53 Property String psPX_Tag ""
54
55 End_Procedure
56
57 { MethodType=Method }
58 Function PX_Registry_Key Returns String
59 String sRegKey sPX_Class sPX_Tag
60
61 Get psPX_Class to sPX_Class
62 Get psPX_Tag to sPX_Tag
63
64 Move (Trim(sPX_Class)) to sPX_Class
65 Move (Trim(sPX_Tag)) to sPX_Tag
66
67 Get RegistryKeyString of ghoApplication to sRegKey
68
69 If (sPX_Class <> "") Move (sRegKey - "\" - sPX_Class ) to sRegKey
70 Else Move (sRegKey - "\Unknown_Class") to sRegKey
71
72 If (sPX_Tag <> "") Move (sRegKey - "\" - sPX_Tag ) to sRegKey
73 Else Move (sRegKey - "\Unknown_Tag") to sRegKey
74
75 Function_Return sRegKey
76 End_Function
77
78 { MethodType=Method }
79 Procedure PX_Delete_Key String sRegKey
80 Boolean bExists bVoid
81 Handle hoRegistry
82
83 Get Create U_cRegistry to hoRegistry
84 Set pbLazyWrite of hoRegistry to False
85 Get KeyExists of hoRegistry sRegKey to bExists
86 If (bExists) Begin
87 Get DeleteKey of hoRegistry sRegKey to bVoid
88 End
89 Send Destroy of hoRegistry
90 End_Procedure
91
92 { MethodType=Method }
93 Procedure PX_Load
94 Boolean bOK bExists bLoad bDelete
95 String sRegKey
96 Handle hoRegistry
97
98 Get pbPX_Delete_OnNoSave to bDelete
99 Get pbPX_Save_Layout to bLoad
100
101 If (bLoad) Begin
102 Get PX_Registry_Key to sRegKey
103
104 Get Create U_cRegistry to hoRegistry
105 Get KeyExists of hoRegistry sRegKey to bExists
106 Send Destroy of hoRegistry
107
108 Get ComCreateAsRegistry of ghoSigCjPropEx True ("HKEY_CURRENT_USER\" + sRegKey) to bOk
109 If (bOk and bExists) Begin
110 Send ComDoPropExchange (pvComObject(ghoSigCjPropEx))
111 End
112 End
113
114 //Delete reg key if not loading. This provides an easy way to delete the registry
115 //entries. Turn off loading and rerun the program. Deleting can be disabled by
116 //setting pbPX_Delete_OnNoSave to false. It can be necessary to delete the
117 //registry entries if the object structure of the application changes.
118 If (not(bLoad) and bDelete) Begin
119 Get PX_Registry_Key to sRegKey
120 Send PX_Delete_Key sRegKey
121 End
122 End_Procedure
123
124 { MethodType=Method }
125 Procedure PX_Save
126 Boolean bOK bExists bVoid
127 Handle hoRegistry
128 String sRegKey
129
130 If (pbPX_Save_Layout(Self)) Begin
131 Get PX_Registry_Key to sRegKey
132
133 Get ComCreateAsRegistry of ghoSigCjPropEx False ("HKEY_CURRENT_USER\" - sRegKey) to bOk
134
135 If bOk Begin
136 Send PX_Delete_Key sRegKey
137 Send ComDoPropExchange (pvComObject(ghoSigCjPropEx))
138 End
139 End
140 End_Procedure
141End_Class
142
143//==============================================================================
144//End of Package - cSigCJPropEx_Mixin.pkg
145//==============================================================================
146