ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Forum AtoutFox : Re: dynamic current control   

Sujet

rss Flux RSS des derniers messages

Vous devez vous identifier pour pouvoir poser une question ou répondre.

dim. 21 janvier 2018, 17h36
ybenam
Algérie Algérie

atoutfox.public.association

Re: dynamic current control

Bonjour
Tu peux utiliser une propriété "trompeuse/fake" telle que dynamicFontbold pour remplir tes bouttons ajoutés à une colonne du grid avec les valeurs réelles d'un champ.
essaie ce bout de code:

PUBLIC oform
oform=NEWOBJECT("madagascar")
oform.Show
RETURN
*
DEFINE CLASS madagascar AS form
  Top = 17
  Left = 130
  Height = 459
  Width = 808
  Caption = "Form1"
  Name = "Form1"

  ADD OBJECT grid1 AS grid WITH ;
    Anchor = 15, ;
    Height = 457, ;
    Left = 0, ;
    Top = 0, ;
    Width = 805, ;
    Name = "Grid1"

  PROCEDURE showcaption
     Lparameters toButton, xtext
      toButton.Caption =allt(xtext)
      toButton.backcolor=iif(mod(recno(),2)=0,rgb(0,255,0),rgb(255,120,140))
      retu
  ENDPROC

  PROCEDURE Load
    sele * from home(1)+"samples\data\customer" into cursor ycurs
  ENDPROC

  PROCEDURE grid1.Init
    with this
    .recordsource="ycurs"
    .recordsourcetype=1
    .deletemark=.f.
    .rowheight=20
    .gridlines=0
        .setall("fontbold",.t.,"header")
    oCol=.column3
    with ocol
    try
    .addobject("command1","commandbutton")
    catch
    endtry
    .currentcontrol="command1"
    .sparse=.f.
    with .command1
    .caption=""
    .backcolor=rgb(0,255,0)
    .specialEffect=2
    .fontsize=10
    .fontname="courier new"
    .mousepointer=15
    .visible=.t.
    endwith
    .DynamicFontBold = 'thisform.showCaption(thisform.grid1.column3.command1,ycurs.contact)'  &&expression must be valid and evaluated at runtime otherwise error!
    endwith
    bindevent(ocol.command1,"mousedown",thisform,"my")
    .refresh
    endwith
  ENDPROC

  procedure my
  LPARAMETERS nButton, nShift, nXCoord, nYCoord
*--- aevent create an array laEvents
   Aevents( myArray, 0)
 *--- reference the calling object
    loObject = myArray[1]
    messagebox("this is:"+loObject.caption,0+32+4096,'',1300)
    endproc

ENDDEFINE
*
*-- EndDefine: madagascar


Permalink : http://www.atoutfox.org/nntp.asp?ID=0000018808
20 087 messages dans le forum • Liste complète des messages

Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3