Print Page | Close Window

enable/disable entire command bar?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=14747
Printed Date: 06 October 2024 at 8:28pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: enable/disable entire command bar?
Posted By: DanielWilson
Subject: enable/disable entire command bar?
Date Posted: 14 July 2009 at 5:29pm
Is there a way to disable then re-enable the entire command bar?

I have a customer using 11.2 and they have a long-running Save routine. If you click Save, then click several command buttons, the whole app crashes.  Sometimes only 1 button click is needed.

I believe that if I can prevent the user from clicking another button until that Save is complete, I can stop the crashes.  At least, I want to test that hypothesis.

So ... can I disable the command bar?

Thanks!


-------------
Daniel Wilson
Software Craftsman in Northern Indiana
http://BlackLocustSoftware.com - http://BlackLocustSoftware.com



Replies:
Posted By: Oleg
Date Posted: 15 July 2009 at 1:36am
Hi,
 
Guess you can just add some varaible that Save process is running and exit from Execute event if so.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Mr.Den
Date Posted: 15 July 2009 at 11:56am
This is how I set the command bar controls to disabled:
 
Dim obBar As CommandBar
Dim obCtrl As CommandBarControl

Dim iLCtr As Integer

On Error GoTo errHandler
   
    Set obBar = CommandBars.item(2)
   
    If bMActive = True Then
                
        For iLCtr = 1 To obBar.Controls.count
           
            Set obCtrl = obBar.Controls.item(iLCtr)
           
            If obCtrl.Id <> ID_CTRL_PLAY Then
                If obCtrl.Id <> 1000 Then
                    obCtrl.Enabled = True
                End If                
            End If
           
        Next iLCtr
       
    Else
                
        For iLCtr = 1 To obBar.Controls.count
           
            Set obCtrl = obBar.Controls.item(iLCtr)
           
            If obCtrl.Id <> ID_CTRL_STOP Then
                If obCtrl.Id <> ID_CTRL_PAUSE Then
                    If obCtrl.Id <> ID_CTRL_ONTOP Then
                        obCtrl.Enabled = False
                    End If
                End If
            End If
           
        Next iLCtr
       
    End If

errHandler:
   
    If Err.Number Then
        MsgBox Err.Number & ",  " & Err.Description, vbCritical, "SetActive"
    End If

 
Edit:
 
Had to leave aburuptly , so here goes:
 
Pass a boolean value to a sub, or as I did, I used bMActive as a modular level variable.
 
Use a for/next loop to iterate through the controls on the commandbar, and set the Enabled property as needed, depending on the Id if desired.
 


-------------
Product: Xtreme SuitePro (ActiveX) version 16.3.1

Platform: Windows 7 Professional (64bit) - SP 1

Language: Visual Basic 6.0 SP 6



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net