-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModificar.prg
195 lines (173 loc) · 4.54 KB
/
Modificar.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
***********************************************
*** MAIN ***************************************
*(LPARAMETERS ccod_loc1
*PUBLIC ccod_loc2
cCaption = "Crear y modificar ciudades"
SELECT Ciudades
*USE Ciudades
SET ORDER TO cod_loc
GO BOTTOM
PUBLIC ccod_loc
ccod_loc = cod_loc + 1
cNueva = "Ciudad..."
*USE
*opdfMod = CREATEOBJECT("pgfMod")
ofrmModificar = CREATEOBJECT("frmModificar")
ofrmModificar.Show()
RETURN ccod_loc
**** DEFINICIONES DE CLASES ************************
DEFINE CLASS grdciudad AS Grid
Left = 65
Top = 120
ColumnCount = 2
Height = 150
ReadOnly = .T.
Enabled = .T.
PROCEDURE Init
This.Columns(1).ReadOnly = .T.
This.Columns(2).ReadOnly = .T.
This.Columns(1).Header1.Caption = "Código"
This.Columns(2).Header1.Caption = "Nombre"
* MESSAGEBOX(STR(ccod_loc
INSERT INTO Ciudades (cod_loc) VALUES (ccod_loc)
ENDPROC
PROCEDURE Click
MESSAGEBOX(This.Columns(2).Controls(2).Name)
Thisform.Refresh()
ENDPROC
PROCEDURE Column1.Click
MESSAGEBOX("Se hizo click en la columna 1")
Thisform.Refresh()
ENDPROC
PROCEDURE Destroy
GO BOTTOM
IF ALLTRIM(nom_ciudad) == ""
delete
pack
* USE
ccod_loc = 0
ENDIF
ENDPROC
ENDDEFINE
DEFINE CLASS pgfMod AS PageFrame
PageCount = 2
Width = 500
Top = 20
Left = 30
ENDDEFINE
* ADD OBJECT opgfMod AS pgfMod ;
* WITH PageCount = 2
* PROCEDURE opgfMod.Init
* This.Pages(1).AddObject("oLabelCodLoc","LabelCodLoc")
* This.Pages(1).AddObject("oCodLoc","CodLoc")
* This.Pages(1).oLabelCodLoc.Visible = .T.
* This.Pages(1).oCodLoc.Visible = .T.
* This.Pages(1).AddObject("oLabelNom_Ciudad","LabelNom_Ciudad")
* This.Pages(1).AddObject("oNom_Ciudad","Nom_Ciudad")
* This.Pages(1).oLabelNom_Ciudad.Visible = .T.
* This.Pages(1).oNom_Ciudad.Visible = .T.
* This.Pages(1).AddObject("ogrdciudad","grdciudad")
* This.Pages(1).ogrdciudad.Visible = .T.
* ENDPROC
DEFINE CLASS frmModificar AS Form
Icon = "Aromal.ico"
BackColor = RGB(192, 192, 192)
Caption = cCaption
Height = 400
Width = 470
Top = 45
Left = 100
ScaleMode = 3
WindowType = 1
ShowWindow = 1
Visible = .T.
Closable = .F.
ADD OBJECT LabelCodLoc AS Label ;
WITH Left = 30, ;
AutoSize = .T., ;
Top = 48, ;
Caption = "Código"
ADD OBJECT CodLoc AS TextBox ;
WITH Left = 90, ;
Value = ccod_loc, ;
Top = 45, ;
ReadOnly = .T., ;
Enable = .F., ;
TabStop = .T., ;
ControlSource = "Ciudades.cod_loc", ;
Width = 50
ADD OBJECT LabelNom_Ciudad AS Label ;
WITH Caption = "Nombre", ;
Left = 185, ;
AutoSize = .T., ;
Top = 48
ADD OBJECT Nom_Ciudad AS TextBox ;
WITH Left = 265, ;
Height = 25, ;
Top = 45, ;
Width = 125
ADD OBJECT ogrdciudad AS grdciudad
PROCEDURE Nom_Ciudad.Init
This.Value = cNueva
This.SelectOnEntry = .T.
This.SetFocus
ENDPROC
PROCEDURE Nom_Ciudad.GotFocus
ThisForm.CodLoc.Refresh()
ENDPROC
ADD OBJECT cmdCargar AS CommandButton ;
WITH Left = 80, ;
Caption = "Cargar", ;
Default = .T., ;
Height = 30, ;
Top = 320, ;
Width = 90
ADD OBJECT cmdSalir AS CommandButton ;
WITH Left = 170, ;
Caption = "Salir", ;
Cancel = .T., ;
Height = 30, ;
Top = 320, ;
Width = 90
ADD OBJECT cmdModificar AS CommandButton ;
WITH Left = 260, ;
Caption = "Modificar", ;
Height = 30, ;
Top = 320, ;
Enabled = .F., ;
Width = 90
PROCEDURE cmdCargar.Click
IF ThisForm.Nom_Ciudad.Value = cNueva .OR. ;
ALLTRIM(ThisForm.Nom_Ciudad.Value) == ""
MESSAGEBOX("Ingrese el nombre de la ciudad " + ;
" a cargar","Mensaje")
ThisForm.Nom_Ciudad.SetFocus
ELSE
REPLACE nom_ciudad WITH ThisForm.Nom_ciudad.Value
ThisForm.Nom_Ciudad.Value = cNueva
* ThisForm.opgfMod.Pages(1).oNom_Ciudad.ReadOnly = .T.
This.Enabled = .F.
Thisform.cmdModificar.Enabled = .T.
ThisForm.Nom_Ciudad.SetFocus
ENDIF
PROCEDURE cmdSalir.Click
IF (ThisForm.Nom_ciudad.Value = cNueva .OR. ;
ThisForm.Nom_ciudad.Value == "")
Release Thisform
ELSE
IF 6==MESSAGEBOX("Cancelar la carga de la ciudad " ;
+ nom_ciudad, 4 + 32 + 256, ;
"Mensaje")
REPLACE nom_ciudad WITH ""
ThisForm.Nom_ciudad.Value = cNueva
ThisForm.Nom_ciudad.SetFocus
ENDIF
ENDIF
ENDPROC
PROCEDURE cmdModificar.Click
Thisform.cmdCargar.Click()
* Thisform.opgfMod.Pages(1).ogrdciudad.Columns(2).Controls(Thisform.opgfMod.Pages(1).ogrdciudad.Columns(2).ControlCount).ReadOnly = .F.
* IF ActivateRow !=
Procedure Click
MessageBox("Click en el form")
ENDDEFINE