Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem making selection in a grid's combobox
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Problem making selection in a grid's combobox
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01575762
Message ID:
01575762
Views:
98
Hi everybody,

I have a very complex form with a TreeView ActiveX on the left (this is the one we bought) and a pageframe with many pages on the right.

In one of the pageframes I have a grid (see attached).

The first combobox is level and it filters the values shown in the second combo (sections).

The problem is that once I selected Level, I am unable to select section with the mouse - it doesn't stick. If I do it with the keyboard, it works.

Here is some relevant code for that grid:
Add Block button's click
local loError as exception
select rsTSBlocks
thisform.nLastRecno = RECNO()
try
    this.Parent.cntSeatBlock.cboLevels.SetFocus()  && attempt to prevent error 2072
	INSERT INTO rsTSBlocks (TemplateID) VALUES (thisform.oCurrentNode.values('TemplateID').value)
	GOTO RECNO('rsTSBlocks')
	this.parent.grdSeatBlocks.refresh()
	thisform.VenuesTree.enabled = .f.
	this.parent.grdSeatBlocks.colLevels.SetFocus()
	thisform.lChangesMade = .t.
	thisform.RefreshButtons()
catch to loError
	if loError.errorno  = 2072 && obscure VFP bug - try the same code again
		oAppObj.write_log('Error 2072 detected when adding a new block ' + loError.message, program(), 'E')	
		=MESSAGEBOX('The error 2072 is the internal VFP bug! Please try closing the form and re-open!',48,'Internal VFP Error')
	endif
endtry
Grid.Valid method
LOCAL llReturn
llReturn = this.ValidateCurrentRow() 
this.Parent.Refresh()
RETURN IIF(m.llReturn, 1, 0)
Set Blocks Page form's method which I believe is called on that page activation
lparameters tnBlocksCount, tnSeatsCount
private nTemplateID

with thisform.pageframe1.pagSeatBlocks.cntSeatBlock
   .cboLevels.rowsource = ''
   use in select('csrBLevels')

   select 0
   create cursor csrBLevels (descrip C(100),LevelID int null)
   insert into csrBLevels values ('All Levels', null)
   nTemplateID = thisform.oCurrentNode.values('TemplateID').value
   =mySQLExec('execute dbo.siriussp_rsGetTemplateLevelsAndSections @TemplateID = ?m.nTemplateID', 'csrLevelsSections',program())
   if not used('csrLevelsSections') or reccount('csrLevelsSections') = 0
      = messagebox('You must first enter Levels and Sections!',48, 'No Levels and Sections')
      return .f.
   endif
   insert into csrBLevels ;
      select descrip, LevelID from csrLevelsSections ;
      group by LevelID, descrip ;
      order by descrip

   .cboLevels.rowsource = 'csrBLevels'
   .cboLevels.requery()
   .cboLevels.listindex = 1

   *  .lblSeatCount.caption = 'Current Blocks Count: ' + alltrim(str(m.tnBlocksCount))
   .lblSeatCount.caption = 'Current Blocks Count: ' + alltrim(str(m.tnBlocksCount)) + ;
      chr(13) + chr(10) + 'Current Seats Count: ' + alltrim(str(m.tnSeatsCount))

   .parent.grdSeatBlocks.colLevels.cboLevels.rowsource = ''
endwith

use in select('csrBlockLevels')
select descrip, LevelID from csrLevelsSections ;
   group by descrip, LevelID into cursor csrBlockLevels NOFILTER

select SectionDescrip, SectionID, LevelID from csrLevelsSections ;
   into cursor csrSections readwrite
if reccount('csrSections') = 0 or isnull(csrSections.SectionDescrip)
   = messagebox('You must first enter Sections!',48, 'No Sections')
   return .f.
endif

index on LevelID tag LevelID
private nLevelID
go top in rsTSBlocks
nLevelID = rsTSBlocks.LevelID
local loColumn, loControl
with thisform.pageframe1.pagSeatBlocks.grdSeatBlocks

   .recordsource = "rsTSBlocks"
   .rowheight = 24

   .highlightstyle = 2
*   .highlightrowlinewidth = 3

   for each loColumn in .columns
      *      loColumn.addproperty("cOriginalControlSource", m.loColumn.controlsource)
      *      loColumn.addproperty("nOriginalWidth", m.loColumn.width)

      for each loControl in m.loColumn.controls
         if upper(m.loControl.baseclass) = "HEADER"
            *             loControl.FontSize = 8
            bindevent(m.loControl,"Click",thisform,"HeaderClick")
            *!*	                    loControl.addproperty("CurrentTag","") && Adds CurrentTag property
            *!*	                    if this.lCreateIndexes && Adds indexes on the fly
            *!*	                        this.CreateTag (m.loControl)
            *!*	                    endif
         endif
      next
   next

   with .colLevels.cboLevels
      .rowsource = ''
      .rowsourcetype = 3
      .parent.controlsource = 'rsTSBlocks.LevelID'

      .rowsource = "select * from csrBlockLevels into cursor csrBLvls nofilter"
   endwith

   with .colCenterMost.cboPosition
      .rowsource = ''
      .rowsourcetype = 3
      .rowsource = "select * from csrSeatsCentricity into cursor csrCM nofilter"
      .parent.controlsource = 'rsTSBlocks.CenterMost'

   endwith

   with .colSections.cboSections
      .rowsource = ''
      .rowsourcetype = 3
      .rowsource = "select * from csrSections where LevelID = ?m.nLevelID into cursor csrSect"
      .parent.controlsource = 'rsTSBlocks.SectionID'

   endwith

   .colRow.controlsource = 'rsTSBlocks.Row'
 *  .colRow.Format = '!KF' && Upper /highlight on entry / varchar
   .colSeatStart.controlsource = 'rsTSBlocks.SeatStart'
   .colNumSeats.controlsource = 'rsTSBlocks.NumSeats'
   .colNumSeats.format = 'K'
   .colRanking.controlsource = 'rsTSBlocks.Ranking'
   .colSequencing.controlsource = 'rsTSBlocks.Sequencing'
   
   .setall('DynamicFontStrikeThru','thisform.RefreshSeatBlockGrid()')
 *  .refresh()
endwith
select rsTSBlocks
and finally the method called from DynamicFontStrikeThru:
private nLevelID
nLevelID = rsTSBlocks.LevelId
thisform.pageframe1.pagSeatBlocks.grdSeatBlocks.colSections.cboSections.requery()
RETURN .f.
I think this is all needed relevant information.

I can reproduce this problem, but I am not sure how to fix it - it may be a bug in VFP.

Can you suggest a solution?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform