Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS toolbar activex buttons properties access.
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00151017
Message ID:
00151044
Views:
16
>I would like to be able to enable and disable buttons in the toolbar,
>but dont't know how to access these objects. They can be manually enabled/disabled at design time, but the only object I see at runtime using the debugger is the toolbar itself. Referencing
>_screen.activeform.object doesn't display any button objects.

Hi Edward,

Let's assume you want to disable the 4th button of the toolbar. In that case (assuming you've named it MyCoolbar) you'r use somthing like:

ThisForm.MyCoolbar.Buttons(4).Enabled = .F.

If, however, you allow the user to customize the toolbar, you might have to scan through the buttons to find the unique key, so you'd write a function to handle this, which would return the index number of the button. You might write a method name FindBtnKey that'd look like this:
* Here's the function:
LPARAMETERS pCoolbar, pcSearchKey

LOCAL lni, lnresult, llfound
STORE 0 TO lni, lnresult
llfound = .F.
DO WHILE NOT llfound AND lni < pCoolbar.Buttons.Count
  lni = lni + 1
  llfound = (pCoolbar.Buttons(lni).Key == pcSearchKey)
ENDDO
IF llfound
  lnresult = lni
ENDIF
RETURN lnresult
* Call the above with what follows
lnkey = ThisForm.FindBtnKey(ThisForm.MyCoolBar, "KeyText")
IF lnkey > 0
  ThisForm.MyCoolbar.Buttons(lnkey).Enabled = .F.
ENDIF
hth,
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform