Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Click
Message
De
18/03/2003 22:23:22
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Grid Click
Divers
Thread ID:
00767353
Message ID:
00767353
Vues:
41
Hi,

I am trying to create a click event in the grid to replace the column 2 cell
when I click any of the grid row. It doesn't response when create a click event in any of the classes. Append below the program I have created.

I am happy to receive any comment on the below program

Thanks in advance.


*Prg
LOCAL oselect
oselect=SELECT()
CLOSE data
*SET MULTILOCKS ON
SET EXCLUSIVE on

SELECT 0
USE bsmain
bs=CREATEOBJECT('frmBs')
bs.addobject('tgrid','sgrid')
*bs.tgrid.setfocus()
bs.show
READ events


use
SELECT(oselect)
RETURN

*==========================
define class frmBs as form
*==========================
caption='BSC selection '
width=350
autocenter=.t.
*keypreview=.t.
*readonly=.t.


add object cmdBtn1 as commandbutton with ;
top=215,;
width=60,;
left=90,;
height=25,;
visible=.t.,;
caption='Select'


add object cmdBtn2 as commandbutton with ;
top=215,;
width=60,;
left=210,;
height=25,;
visible=.t.,;
caption='Cancel'




*!* add object sline as line with ;
*!* top=10,;
*!* width=850,;
*!* height=1 ,;
*!* visible=.t.

*!* add object tgrid as Sgrid with ;
*!* controlsource='bscs.dbf' ,;
*!* width=350 ,;
*!* scrollbars=2


*!* proc keypress
*!* para nkey,altkey
*!* if nkey=27
*!* frmbs.cmdbtn2::click
*!* endif

*!* if nkey=13
*!* frmbs.cmdbtn1::click
*!* endif

*!* endproc


proc cmdBtn2.click
thisform.Release
clear events
return
endproc

proc cmdBtn1.click
M.CCODE=bsmain.bno
M.CNAME=bsmain.bdesc
release thisform
clear events
return
ENDPROC


PROCEDURE CLICK
? 'test'
ENDPROC

proc init
*this.tgrid.setfocus()
endproc

ENDDEFINE

*=========================
define class sgrid as grid
*=========================
controlsource='bsmain.dbf'
*columncount=1
width=350
scrollbars=2
movable=.f.
visible=.t.
enabled=.t.
controlsource='bscs.dbf'





add object col1 as cola with ;
visible=.t.,;
enabled=.t.,;
head1.caption='Code',;
width=255,;
controlsource="str(bsmain.bno,8)+' '+bsmain.bdesc"


add object col2 as colb with ;
visible=.t.,;
enabled=.t.,;
head3.caption='Selected',;
width=55,;
controlsource='bsmain.select'

PROCEDURE click
IF bsmain.select='X'
REPLACE bsmain.select WITH ' '
ELSE
RLOCK()
replace bsmain.select WITH 'X'
unlock()
endif
endproc


enddefi


define class cola as column

add object head1 as head2

PROCEDURE click
IF bsmain.select='X'
REPLACE bsmain.select WITH ' '
ELSE
RLOCK()
replace bsmain.select WITH 'X'
unlock()
endif

endproc


enddefi

define class colb as column
format='!x'

add object head3 as header

PROCEDURE head3.click
? 'test2'
endif

enddefi



*!* define class text1 as textbox

*!* proc DBLclick
*!* frmbs.cmdbtn1::click
*!* endproc

*!* enddefi


defin class head2 as header
enable=.t.
*&controlsource='cust.date'

ENDDEFINE
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform