Print Page | Close Window

CommandBar selected item

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=10915
Printed Date: 18 September 2025 at 7:28am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CommandBar selected item
Posted By: lexicon
Subject: CommandBar selected item
Date Posted: 05 June 2008 at 4:56am
Hello
How to implement so when i'm selecting an item from commandbar to stay selected until i'm selecting something else?
 
Thank you



Replies:
Posted By: Aaron
Date Posted: 05 June 2008 at 9:14am
Hi,
 
Please, explain what you mean by: "an item"


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: lexicon
Date Posted: 05 June 2008 at 9:24am
a button


Posted By: Aaron
Date Posted: 05 June 2008 at 11:14am
Hi,
 
You mean like a checked button?
 
 
Just like an ordinary button with  .Checked = true
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: lexicon
Date Posted: 05 June 2008 at 2:42pm
Yes but how?
When i click on a button i'm using this procedure to check what is pressed
 
Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
Select Case Control.id
    Case 101
    
        form1.Show 1
    Case 102
        form2.Show 1
end select
 
 
Where do i write the .checked=true?


Posted By: jpbro
Date Posted: 05 June 2008 at 3:32pm
Assuming you want the control with ID 101 checked:


Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
Select Case Control.id
    Case 101
       Control.Checked = True

        form1.Show 1
    Case 102
        form2.Show 1
end select



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 05 June 2008 at 3:35pm
Hi,
 
The CommandBars_Execute will be fired when a button is pressed 
 
When you want to check which item is active you can use the CommandBars_Update event
 
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
    Select Case Control.ID
        Case ID_TOOLBAR_BUTTON_1
            Control.Checked = Form1.IsLoaded 'Isloaded = public variable in form1 which is set to true when form is loaded
        Case ID_TOOLBAR_BUTTON_2
            Control.Checked = Form2.IsLoaded 'Isloaded = public variable in form2 which is set to true when form is loaded 
    End Select
End Sub
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: Mr.Den
Date Posted: 06 June 2008 at 11:19am
Originally posted by Aaron Aaron wrote:

            Control.Checked = Form1.IsLoaded 'Isloaded = public variable in form1 which is set to true when form is loaded
 
Careful with checking variable states like that, if Form1 is not loaded, referencing a public variable on Form1 will cause it to load if I am not mistaken.
 
You could set an object as a form;
 
Private obFrm As Form
 
Somehwere in code when form is needed:
 
Set obFrm = New Form1
obFrm.Show
 
then later in code, check it like this:
 
If Not obFrm Is Nothing Then
    'form is loaded
End If
 


Posted By: Aaron
Date Posted: 07 June 2008 at 5:15am
Originally posted by Mr.Den Mr.Den wrote:

 
Careful with checking variable states like that, if Form1 is not loaded, referencing a public variable on Form1 will cause it to load if I am not mistaken.
 
Hi,
 
Only the Form_Initialize event will be fired.


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



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