Hello friends,
I have something really weird happening. I am developing a new project which is in very early phase, and so it has very few controls as yet (i.e. fewer things to go wrong). Essentially this app is designed to store and draw real estate legal lot descriptions and shapes (to scale), and to calculate acreage. Thus far it has only progressed to the phase of drawing the shape, by using the Form.Line control and a little trigonometry.
THE PROBLEM: My app does OK drawing the shapes (though I am having a little trouble with the aspect ratio of my screen pixels, for which I am working on a correction in the DrawLot method). BUT... when the mouse is placed over either of the CommandGroups, the entire form blanks out... everything except the blank form disappears... the drawn shape (usually an irregular polygon) and all other controls disappear!
Then, after the form blanks out, if the mouse is clicked on the (now invisible) area where a CoommandGroup has been placed, the form's controls and the drawn polygon become visible again. Even more strange is that depending upon which control is clicked, other controls become only partially visualized (e.g. after clicking on the "Switch Lot" button, only one of the four buttons on the other command group becomes visible. After redrawing the polygon or switching to another in the table, it all becomes visible and remains so (no more bad behavior).
Can anyone tell me what's going on?
Following is the code, (from the Class Browser)
TIA
BillvV
I have something really weird happening. I am developing a new project which is in very early phase, and so it has very few controls as yet (i.e. fewer things to go wrong). Essentially this app is designed to store and draw real estate legal lot descriptions and shapes (to scale), and to calculate acreage. Thus far it has only progressed to the phase of drawing the shape, by using the Form.Line control and a little trigonometry.
THE PROBLEM: My app does OK drawing the shapes (though I am having a little trouble with the aspect ratio of my screen pixels, for which I am working on a correction in the DrawLot method). BUT... when the mouse is placed over either of the CommandGroups, the entire form blanks out... everything except the blank form disappears... the drawn shape (usually an irregular polygon) and all other controls disappear!
Then, after the form blanks out, if the mouse is clicked on the (now invisible) area where a CoommandGroup has been placed, the form's controls and the drawn polygon become visible again. Even more strange is that depending upon which control is clicked, other controls become only partially visualized (e.g. after clicking on the "Switch Lot" button, only one of the four buttons on the other command group becomes visible. After redrawing the polygon or switching to another in the table, it all becomes visible and remains so (no more bad behavior).
Can anyone tell me what's going on?
Following is the code, (from the Class Browser)
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- Form: form1 (c:\myapps\lotdraw\lotdraw.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 05/16/04 09:50:05 AM
*
DEFINE CLASS form1 AS form
Top = 0
Left = 0
Height = 622
Width = 994
ShowWindow = 2
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT commandgroup2 AS commandgroup WITH ;
AutoSize = .F., ;
ButtonCount = 4, ;
Value = 1, ;
Height = 37, ;
Left = 768, ;
Top = 575, ;
Width = 204, ;
Name = "Commandgroup2", ;
Command1.AutoSize = .F., ;
Command1.Top = 5, ;
Command1.Left = 5, ;
Command1.Height = 27, ;
Command1.Width = 47, ;
Command1.Caption = "\<Left", ;
Command1.Name = "Command1", ;
Command2.AutoSize = .F., ;
Command2.Top = 5, ;
Command2.Left = 54, ;
Command2.Height = 27, ;
Command2.Width = 47, ;
Command2.Caption = "\<Right", ;
Command2.Name = "Command2", ;
Command3.AutoSize = .F., ;
Command3.Top = 5, ;
Command3.Left = 103, ;
Command3.Height = 27, ;
Command3.Width = 47, ;
Command3.Caption = "\<Up", ;
Command3.Name = "Command3", ;
Command4.AutoSize = .F., ;
Command4.Top = 5, ;
Command4.Left = 152, ;
Command4.Height = 27, ;
Command4.Width = 47, ;
Command4.Caption = "\<Down", ;
Command4.Name = "Command4"
ADD OBJECT commandgroup1 AS commandgroup WITH ;
AutoSize = .F., ;
ButtonCount = 2, ;
Value = 1, ;
Height = 66, ;
Left = 18, ;
Top = 546, ;
Width = 80, ;
Name = "Commandgroup1", ;
Command1.AutoSize = .F., ;
Command1.Top = 5, ;
Command1.Left = 5, ;
Command1.Height = 27, ;
Command1.Width = 70, ;
Command1.Caption = "\<Switch lot", ;
Command1.Name = "Command1", ;
Command2.AutoSize = .F., ;
Command2.Top = 34, ;
Command2.Left = 5, ;
Command2.Height = 27, ;
Command2.Width = 70, ;
Command2.Caption = "\<New Lot", ;
Command2.Name = "Command2"
ADD OBJECT commandgroup3 AS commandgroup WITH ;
AutoSize = .F., ;
ButtonCount = 2, ;
Value = 1, ;
Height = 37, ;
Left = 525, ;
Top = 575, ;
Width = 134, ;
Name = "Commandgroup3", ;
Command1.AutoSize = .F., ;
Command1.Top = 5, ;
Command1.Left = 5, ;
Command1.Height = 27, ;
Command1.Width = 61, ;
Command1.Caption = "\<Larger", ;
Command1.Name = "Command1", ;
Command2.AutoSize = .F., ;
Command2.Top = 5, ;
Command2.Left = 68, ;
Command2.Height = 27, ;
Command2.Width = 61, ;
Command2.Caption = "\<Smaller", ;
Command2.Name = "Command2"
ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 10, ;
Alignment = 2, ;
Caption = "Label1", ;
Height = 18, ;
Left = 415, ;
Top = 11, ;
Width = 45, ;
Name = "Label1"
PROCEDURE drawlot
** METHOD: drawlot
*TABLES: LotList.dbf and LotData.dbf
*PLAN: Use screen pixels as a matrix of one-
*foot units. The aspect ratio will need to be
*developed. Simple actual screen measure is
*0.9372 vert = 1.000 horiz.
*The SCALE field in LotList table is a multiplier
*to allow full screen usage regardless of lot size.
with this
select lotlist
.currentx = basex
.currenty = basey
.drawwidth = 3
SELECT lotdata
GO bottom
nLastRec = RECNO()
GO top
SCAN
*Provide for two lines of closure, 1 by
*bearings, and 2nd to join Point-of-
*beginning.
IF RECNO() = nLastRec
nCurrX = .currentX
nCurrY = .currentY
.line(lotlist.basex, lotlist.basey)
.currentX = nCurrX
.currentY = nCurrY
.forecolor = RGB(175,175,175)
ENDIF
do case
case azimuth >= 270
nAngle = 360 - azimuth
xSign = -1
ySign = -1
case azimuth >= 180
nAngle = azimuth - 180
xSign = -1
ySign = 1
case azimuth >= 90
nAngle = 180 - azimuth
xSign = 1
ySign = 1
otherwise
nAngle = azimuth
xSign = 1
ySign = -1
endcase
nYLen = cos(DTOR(nAngle)) * feet * .9372 * ySign
nXlen = sin(DTOR(nAngle)) * feet * xSign
nNewX = .currentX + (nXlen * lotlist.scale)
nNewY = .currentY + (nYlen * lotlist.scale)
.line(nNewX, nNewY)
ENDSCAN
.forecolor = RGB(0,0,0)
nAcreage = .acreage()
.label1.caption = ALLTRIM(STR(nAcreage,6,2)) ;
+ " acres"
endwith
ENDPROC
PROCEDURE acreage
*METHOD: numacres
SELECT lotdata
SET ORDER TO TAG current
DIMENSION x[1],y[1]
x[1]=lotlist.basex
y[1]=lotlist.basey
cntr=1
grandsum=0
SCAN
cntr=cntr+1
DIMENSION x[cntr],y[cntr]
*Parse and calculate x & y from BEARING
degrees = VAL(SUBSTR(bearing,3,2))
minutes = VAL(SUBSTR(bearing,7,2))
seconds = VAL(SUBSTR(bearing,11,2))
secs = seconds + (minutes * 60)
fractdegr = secs / 3600
degrees = degrees + fractdegr
vecstr=LEFT(bearing, 1)+RIGHT(bearing, 1)
xx = SIN(DTOR(degrees)) * feet
yy = COS(DTOR(degrees)) * feet
DO CASE
CASE vecstr= "NE"
yy = -yy
CASE vecstr= "SE"
* x and y are both +
CASE vecstr= "SW"
xx = -xx
CASE vecstr= "NW"
xx = -xx
yy = -yy
ENDCASE
*------------------------------------------
x[cntr]=x[cntr-1]+xx
y[cntr]=y[cntr-1]+yy
sum=(x[cntr]*y[cntr-1]) - ;
(x[cntr-1] * y[cntr])
grandsum=grandsum+sum
ENDSCAN
area=ABS(grandsum/2)
acres=area/43560
RETURN acres
ENDPROC
PROCEDURE Load
set default to \myapps\lotdraw
close all
use lotlist in 0
use lotdata in 0 excl
ENDPROC
PROCEDURE Init
DO FORM lotselector
SELECT lotdata
cCmdStr = "index on linenum for lotidn = " ;
+ CHR(34) + alltr(lotlist.lotidn) ;
+ CHR(34) + " tag current"
&cCmdStr
this.drawlot()
ENDPROC
PROCEDURE commandgroup2.Click
SELECT lotlist
DO case
CASE this.Value = 1
replace lotlist.basex WITH lotlist.basex-25
CASE this.Value = 2
replace lotlist.basex WITH lotlist.basex+25
CASE this.Value = 3
replace lotlist.basey WITH lotlist.basey-25
CASE this.Value = 4
replace lotlist.basey WITH lotlist.basey+25
ENDCASE
thisform.cls
thisform.drawlot()
ENDPROC
PROCEDURE commandgroup1.Click
DO case
CASE this.Value = 1
DO FORM lotselector
SELECT lotdata
cCmdStr = ;
"index on linenum for lotidn = " ;
+ CHR(34) + alltr(lotlist.lotidn) ;
+ CHR(34) + " tag current"
&cCmdStr
thisform.cls
thisform.drawlot()
endcase
ENDPROC
PROCEDURE commandgroup3.Click
SELECT lotlist
DO case
CASE this.Value=1
replace scale WITH lotlist.scale+.10
CASE this.Value=2
replace scale WITH lotlist.scale-.10
ENDCASE
thisform.Cls
SELECT lotdata
thisform.drawlot()
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************
TIA
BillvV