Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add a ctrl source to a commandbutton
Message
 
 
To
15/05/2012 04:29:22
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01543604
Message ID:
01543608
Views:
59
Hi dragan,

i try
 BINDEVENT( oGrid.Column1.Text2 ,"Refresh" , oGrid , "WhenModify" , 1 )
   BINDEVENT( oGrid.Column1 ,"Refresh" , oGrid , "WhenModify" , 1 )
and a method whenmodify
LOCAL laObjects(1),;
  loEventSource

AEVENTS( laObjects, 0)
loEventSource = laObjects(1)

WITH loEventSource
 
  DO CASE

      *-----------------------------------------------------------------
    CASE INLIST( .T. , 'text2' $ LOWER( .NAME ) , .BASECLASS <> 'Commandbutton')
  
      loEventSource.CAPTION = V_Resident.cetats


    OTHERW
  ENDCASE


ENDWITH
But it goes only when the aftercolchange() is launched.....
it is not a really dynamicAllrefresh()

i try with many controls.....


>>Hi all,
>>
>>I want add data to a caption off a commandbutton IN A GRID.
>>i want dus put a controlsource in this control.
>>
>>How can i do it ?
>>
>>ogrid.controls(1) = header
>>ogrid.controls(2) = textbox
>>ogrid.controls(3) = commandbutton
>>
>>
>>Bindevents ?
>>assign property to ctrl source of text2 object
>
>Tricky, to say the least, because even if you set sparse=.t. for that column, it may set the caption to the same value for all rows. One trick I learned from Martina (or was it Martin Haluza?) is to introduce a dynamicfontbold_access method, which would fire before any refresh, and within that method to manipulate other properties of a column. In there, you could do .commandbutton.caption=[whatever you want].
>
>Alternately, you could, in grid's .init(), do this
>
>bindevent(this.column8.commandbutton, "refresh", this, "myRefresh")
>
>and then in grid.myRefresh, use aEvents() to get a reference to the commandbutton, and then assign its caption to whatever you want.
>
>I've tried both methods, although my goal was to accomplish something else, and I had limited success - it would work most of the time, except when it wouldn't :).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform