![]()  | 
 
CommandBar selected item | 
 
    Post Reply  
   | 
  
| Author | |
   
   lexicon  
   
   Groupie  
   Joined: 26 January 2007 Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: CommandBar selected itemPosted: 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 
    | 
 |
![]()  | 
 |
   
   Aaron  
   
   Senior Member  
   Joined: 29 January 2008 Status: Offline Points: 2192  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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....  | 
 |
![]()  | 
 |
   
   lexicon  
   
   Groupie  
   Joined: 26 January 2007 Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 05 June 2008 at 9:24am | 
 
| 
   
    
   a button
    
   
   | 
 |
![]()  | 
 |
   
   Aaron  
   
   Senior Member  
   Joined: 29 January 2008 Status: Offline Points: 2192  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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....  | 
 |
![]()  | 
 |
   
   lexicon  
   
   Groupie  
   Joined: 26 January 2007 Status: Offline Points: 46  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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? 
    | 
 |
![]()  | 
 |
   
   jpbro  
   
   Senior Member  
   Joined: 12 January 2007 Status: Offline Points: 1357  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 05 June 2008 at 3:32pm | 
 
| 
   
    
   Assuming you want the control with ID 101 checked: 
   
  
  | 
 |
| 
   
     
     Product: Xtreme SuitePro (ActiveX) version 16.2.6 
   
  Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6  | 
 |
![]()  | 
 |
   
   Aaron  
   
   Senior Member  
   Joined: 29 January 2008 Status: Offline Points: 2192  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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....  | 
 |
![]()  | 
 |
   
   Mr.Den  
   
   Groupie  
   Joined: 26 August 2007 Status: Offline Points: 50  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 06 June 2008 at 11:19am | 
 
   
   
 
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  | 
 |
![]()  | 
 |
   
   Aaron  
   
   Senior Member  
   Joined: 29 January 2008 Status: Offline Points: 2192  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 07 June 2008 at 5:15am | 
 
   
   
 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....  | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |