Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - CommandBar selected item
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CommandBar selected item

 Post Reply Post Reply
Author
Message
lexicon View Drop Down
Groupie
Groupie


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post Topic: CommandBar selected item
    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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
lexicon View Drop Down
Groupie
Groupie


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post Posted: 05 June 2008 at 9:24am
a button
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
lexicon View Drop Down
Groupie
Groupie


Joined: 26 January 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote lexicon Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
Mr.Den View Drop Down
Groupie
Groupie
Avatar

Joined: 26 August 2007
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mr.Den Quote  Post ReplyReply Direct Link To This Post 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
 
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.234 seconds.