Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid & Combo & Valid.
Message
From
25/04/2000 06:04:34
 
 
To
25/04/2000 05:01:55
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00363023
Message ID:
00363040
Views:
27
Hi Cemal.

>>When i click a command button on the form its run perfect.
But when i click a command button on a toolbar the valid event does not work.
Is this another bug? <<

No, this is not a bug. The problem here is that toolbars do not get focus. So the valid of the activeControl on the form does not fire. What you have to do is add a method to your form class, call it WriteBuffer, and SetFocus to the form's ActiveControl. Setting focus to it will cause its Valid to fire.

Code something like this:
LOCAL loControl, lnActiveColumn, loColumn

IF TYPE( '_Screen.Activeform.ActiveControl.Name' ) = 'C'
  loControl = _Screen.Activeform.ActiveControl
  IF LOWER( loControl.BaseClass ) = 'grid'
    *** Grids are special cases
    *** You have to specifically set focus to the active column
    *** in the grid. You have to loop through the grid's columns
    *** collection because active column actually refers to the grid's
    *** column order
    lnActiveColumn = loControl.ActiveColumn
    FOR EACH loColumn IN loControl
      IF loColumn.Columnorder = lnActiveColumn
        loColumn.Text1.SetFocus()
        EXIT
      ENDIF
    ENDFOR
  ELSE
    loControl.SetFocus()
  ENDIF
ENDIF
I wrote this code off the top of my head. It is untested and I do not guarantee that it is bug free. You will have to test it, but it gives you the general idea of what you need to do.

Marcia
Previous
Reply
Map
View

Click here to load this message in the networking platform