Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command button in grid
Message
From
23/11/2005 05:56:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/11/2005 02:42:23
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01071465
Message ID:
01071513
Views:
17
>Hi
>I have a Command button in grid.
>The grid base on cursor and this column controlsource is memo (comment).
>I want that the command button (with caption 'View') will be visiable only if the memo not empty.
>Thank's

Chaim,
You need a dynamic property to do it. ie:
Public oForm
oForm = Createobject('myForm')
oForm.Show
Define Class myForm As Form
  DataSession = 2
  Width = 700
  Add Object myGrid As Grid
  Procedure Load
    Use employee
  Endproc

  Procedure Init
    With This.myGrid
      .Width = 700
      .ColumnCount = 5
      With .Columns(5)
        .AddObject('myCommand1','myButton')
        .AddObject('myCommand2','myButton')
        .DynamicCurrentControl = ;
           "(Iif(Atc('sales',employee.Title) > 0,'myCommand1','myCommand2'))"
        .Sparse = .F.
        .myCommand1.Caption = 'View'
        .myCommand1.Visible = .T.
        .myCommand2.Visible = .F. && this is the default - here only to signify
      Endwith
    Endwith
  Endproc
Enddefine

Define Class myButton As CommandButton
  Procedure Click
    Messagebox(employee.notes)
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform