Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unhandled win32 error on down arrow in grid
Message
From
20/07/2006 12:59:36
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Unhandled win32 error on down arrow in grid
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01138142
Message ID:
01138142
Views:
63
Grid sits on a page in a pageframe. This form has numerous pages and almost every page has a grid on it. The grid is loaded when the page is activated. This works on all pages except for one. On one page, the layout of the grid is not the same as the layout of the cursor that is created. To handle this, the grid properties are set in the page.activate() after the cursor is created. For some reason, if there is more than one record in the cursor, only the first record is displayed and when you click on the grid to select it and press down arrow (even though only one record is visible) a C5 error occurs. The line in the vfp9err.log is the read events line in the main.prg There is code in the afterrowcolchange of the grid but the code is identical to the other grids. It appears to have something to do with the fact that the 2nd record does not display in the grid, but if I slap a generic grid on the form, then the 2nd record displays until I run the code in the page activate which sets the grid's properties. Any ideas anyone?
*--Page activate()
IF !USED("cContact") OR cContact.Occup_id != THISFORM.pcOccup_id

    THIS.GrdMain.RECORDSOURCE=""

    =SQLFire("SE","{oj occ_cont LEFT OUTER JOIN occ_ph ON  Occ_cont.cont_id = Occ_ph.id   AND  Occ_ph.sequence = 1}",;
        "occ_cont.occup_id LIKE '" + THISFORM.pcOccup_id+ "'","occ_cont.*, occ_ph.phone",;
        "cContact","ORDER BY occ_cont.sequence")
ENDIF

*--cContact exists now and has 2 records

SELECT cContact

THIS.GrdMain.RECORDSOURCE="cContact"

WITH THIS.GrdMain
        .Width = 669
    	.FontSize = 9
    	.Fontname = 'Arial'
        .Column1.WIDTH = 45
        .Column2.WIDTH = 213
        .Column3.WIDTH = 64
        .Column4.WIDTH = 45
        .Column5.WIDTH = 34
        .Column6.WIDTH = 57
	.Column7.WIDTH = 114
        .Column8.WIDTH = 75
        .Column1.Header1.CAPTION = 'Seq'
        .Column2.Header1.CAPTION = 'Name/Title'
        .Column3.Header1.CAPTION = 'Type'
        .Column4.Header1.CAPTION = 'Owner'
        .Column5.Header1.CAPTION = 'Key'
        .Column6.Header1.CAPTION = 'Occupant'
        .Column7.Header1.CAPTION = 'Business'
        .Column8.Header1.CAPTION = 'Apt/Suite'
        .Column1.Header1.ALIGNMENT = 2
        .Column2.Header1.ALIGNMENT = 2
        .Column3.Header1.ALIGNMENT = 2
        .Column4.Header1.ALIGNMENT = 2
        .Column5.Header1.ALIGNMENT = 2
        .Column6.Header1.ALIGNMENT = 2
        .Column7.Header1.ALIGNMENT = 2
        .Column8.Header1.ALIGNMENT = 2
        .Column4.Alignment = 2
        .Column5.Alignment = 2
        .Column6.Alignment = 2
        .Column1.CONTROLSOURCE = "cContact.sequence"
        .Column2.CONTROLSOURCE = "(ALLTrim(Last) + IIF(!EMPTY(LAST) AND !EMPTY(FIRST),', ','')  + ALLTRIM(First) + IIF(!EMPTY(MIDDLE),' ' + ALLTRIM(Middle),'') + IIF(!EMPTY(Title), ' / ' + ALLTRIM(TITLE),''))"
        .Column3.CONTROLSOURCE = "type"
        .Column4.CONTROLSOURCE = "(IIF(owner,'Y',''))"
        .Column5.CONTROLSOURCE = "(IIF(key_holder,'Y',''))"
        .Column6.CONTROLSOURCE = "(IIF(Occupant,'Y',''))"
        .Column7.CONTROLSOURCE = "Institutio"
        .Column8.CONTROLSOURCE = "(ALLTRIM(addr_1)+' '+ALLTRIM(apt_room))"
ENDWITH

THIS.GrdMain.SETFOCUS
*--Grid AfterRowColchange
LPARAMETERS nColIndex
DODEFAULT(nColIndex)
WITH THIS.PARENT && textboxes/editbox on the page display values from the grid recordsource
   .Notes.Refresh()
   .Phone.Refresh()
   .ButNotes.Refresh()
ENDWITH
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform