Groups > dBase > dBase bug reports > Re: Grid onleftmousedown Error




Grid onleftmousedown Error

Grid onleftmousedown Error
Wed, 09 Apr 2008 00:32:43 -040
/*
Here are two prgs that code 1 non modal form that calls a second modal form with
a simple grid on modal form
The Grid has an onleftmousedown event - With an obvious error in it - an
undefined variable
When you click on the Grid, Dbase catches the error
Then when you close the underlying form - Dbase crashes

Paste this 1st Part into File called Frm_First.prg

Paste 2nd part into file called Grid_err.prg


Run Frm_First

*/
Shell(.f.)

local Frm
Frm = new BaseForm1()


  Clear
  ? "Open Form "
  Frm.open()


class BaseForm1 of FORM
    with (this)
	 onOpen  = Class::Frm_Open
	 OnClose = Class::Frm_Close
	 height  = 16.0
	 left    = 20.0
	 top     = 4.0
	 width   = 78.0
	 text    = "1st Form"
	 mdi     = .f.

    endwith


this.PUSHBUTTON1 = new PUSHBUTTON(this)  //Close This Form
  with (this.PUSHBUTTON1)
    onClick = class::Pb1_CLICK
    height = 1.5
    left = 5.0
    top = 12.0
    width = 12.0
    text = "Close"
  endwith

  this.PUSHBUTTON1 = new PUSHBUTTON(this) //Open Modal Form
  with (this.PUSHBUTTON1)
    onClick = class::Pb2_CLICK
    height = 1.5
    left = 25.0
    top = 12.0
    width = 12.0
    text = "Modal Frm"
  endwith


Procedure Frm_Open
Clear

Return

Procedure Frm_Close


Return

Procedure Pb1_CLICK

? "click 1"
Form.Release()

Return

Procedure Pb2_CLICK

Set Procedure to Grid_Err

? "click 2 call modal form"
Do Grid_Err with True

Return

Endclass

**********************************************************
Above 

**********************************************************
/*
All code below here paste into a file called
Grid_err.prg


*/
if not file('Table1.dbf')

create table Table1;
(Field1 char(10),Field2 char(10),Field3 char(10)) 

Endif

if not file('Table2.dbf')

create table Table2;
(Field1 char(10),Field2 char(10),Field3 char(10)) 

Endif



** END HEADER -- do not remove this line
//
// Generated on 06/26/2006
//
// BMODAL   = T  - FOR MODAL FORM
// OBJ_NAME = MYCOMBOBOX2 IE - OBJECT USER CLICKED ON
// FN_ROOT  = EXAM OR TRAN IE

parameter bModal

Local Mdl_form

Mdl_form = new BaseForm2()

if (bModal)
  Mdl_Form.mdi = false // ensure not MDI
  Mdl_Form.readModal()

else
  Clear
  ? "Open Form "
  Mdl_Form.open()
endif


class BaseForm2 of FORM
with (this)
onOpen = class::FORM_ONOPEN
mdi = .f.

height = 12.0
left = 10.0
top = 2.0
width = 55.0
text = ""
endwith

this.Q1 = new QUERY()
this.Q1.parent = this
    with (this.Q1)
	    left = 32.8571
	    top = 12.6364
	    sql = 'select * from "Table1.DBF"'
	    active = true
    endwith

this.GRID1 = new GRID(this)
    with (this.GRID1)
	    dataLink = form.Q1.rowset
	    OnLeftMouseDown = Class::Grid1_Lmd
	    rowSelect = true
	    height = 8.0
	    left = 5.0
	    top = 1.0
	    width = 65.0
	endwith

this.PUSHBUTTON1 = new PUSHBUTTON(this)
    with (this.PUSHBUTTON1)
    onClick = class::PUSHBUTTON1_ONCLICK
    height = 1.0
    left = 2.0
    top = 10.0
    width = 15.0
    text = "Next"
    endwith

this.rowset = this.Q1.rowset
*****************************************************************
Procedure form_onOpen
   

? "form2 Open "

return
***************************************************************
Procedure PUSHBUTTON1_onClick

   if Form.rowset.atLast()
	 msgBox("You are at the first record","Error",64)
   else
	 Form.rowset.next()
   endif

return
**************************************************************
Procedure Grid1_Lmd

 ? "Left Mouse Down Method "

? NoVariable //undefined




return

endclass

Don
Post Reply
Re: Grid onleftmousedown Error
Wed, 9 Apr 2008 09:45:38 -0400
Thanks Don, I submitted this as QAID 6408

- Kathy
QA
dBI

In article <JCTgArfmIHA.700@news-server>, drplum@verizon.net says...
> /*
> Here are two prgs that code 1 non modal form that calls a second modal form
with a simple grid on modal form
> The Grid has an onleftmousedown event - With an obvious error in it - an
undefined variable
> When you click on the Grid, Dbase catches the error
> Then when you close the underlying form - Dbase crashes
> 
> Paste this 1st Part into File called Frm_First.prg
> 
> Paste 2nd part into file called Grid_err.prg
> 
> 
Post Reply
about | contact