Results 1 to 12 of 12

Thread: How do I get a button to stay down???????????????

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Red face

    Like in word/wordpad for bold,italic,underline etc. I want to click a button and have it stay down (a boolean set) till it is clicked again. So I need it indented.

    I could write my own control but surely there's a short cut!!!

    back to sleep

    zzzzzzzzzzzzzzzzzzzzzz

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    You can use the toolbar control, where the buttons have a pressed/unpressed property that you can control thru code.
    "It's cold gin time again ..."

    Check out my website here.

  3. #3
    Guest
    Or you can use a CheckBox and set it's Style property to Graphical.

  4. #4
    Member
    Join Date
    Jun 2000
    Location
    North of France
    Posts
    49

    Exclamation

    Maybe it's my turn,...


    To do this, my idea is to paint your own button. I explain:

    You take a CommandButton (Classic VB control), and you set it's Style property to Graphical. You need two Graphical files:

    one will represent the button activate,
    the other one, the button inactivate.

    With a boolean, you just have to switch between the two graphical file.

    I hope it will help you, talk to you soon.
    Hi-Tech Engineer

  5. #5
    Lively Member
    Join Date
    Jul 2000
    Posts
    72
    you can use an Img Button. When you click on the image it will act as a button.
    Following is some code I did for work in access. It is in VB.

    Sub ToggleUIButtons(intCurrButton As Integer)
    Static intLastClicked As Integer

    If intCurrButton <> intLastClicked Then
    intLastClicked = intCurrButton

    imgAppt.SpecialEffect = 0

    Select Case intCurrButton
    Case 2
    imgAppt.SpecialEffect = 1

    End Select

    intCurrButton = intLastClicked
    End If

    End Sub

    This Sub makes the button look depressed. Has to do with the "specialeffect" property. If this helps or you need more let me know.

    VB 6 Professional Edition

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Toolbar... Does that work vertically? like down the left hand side of a form?

    Checkbox graphical??? what's that look like? Now I know why they made you a guru! never done that before.

    The image options I know will work but I was just wondering if there was a "normal" way, if there is such a thing... Let me have a look at the checkbox...
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Meg, You're a legend! I had no idea that a check box does that!!!!

    Let me $$$$ your ####

    (I've been censored a lot lately so I'm watching my vocab!)
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  8. #8
    Guest
    You can also do the same with OptionButtons. They will appear as Buttons that work in Groups (Like the Alignment buttons).

  9. #9
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Paul -
    You seem to be settled on these other options, but yes, the toolbar can be aligned vertically on the left-hand side of a form. If you haven't used it before, its part of the Microsoft Windows Common Controls (out of Project -> Components) - it is in the same group as the TreeView, ListView, StatusBar, ImageList, etc. It works in conjunction with the ImageList, where you store the images for your toolbar buttons.
    "It's cold gin time again ..."

    Check out my website here.

  10. #10
    Member
    Join Date
    Jun 2000
    Location
    North of France
    Posts
    49

    Talking

    Very funny your post Paul282 !!
    Hi-Tech Engineer

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Originally posted by BruceG
    Paul -
    You seem to be settled on these other options, but yes, the toolbar can be aligned vertically on the left-hand side of a form. If you haven't used it before, its part of the Microsoft Windows Common Controls (out of Project -> Components) - it is in the same group as the TreeView, ListView, StatusBar, ImageList, etc. It works in conjunction with the ImageList, where you store the images for your toolbar buttons.
    I'll check that too. I have used the toolbar but only once and very basically. I don't normally make apps to pass out to every day users, just tools for other engineers in my team.

    THX
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  12. #12
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <<?>> Walk Aroung..Looks Good (to me...)

    'this really looks too cool...
    'can't get it to work with the normal button look but
    'if I use the sunken 3d effect and call it to set it
    'looks really really good...sunken and stays sunken.
    'to view it copy and paste this code.
    'Form1 Command1
    '

    Option Explicit

    Public PixX, PixY, CTop, Clft, CRgt, CBtm, i, AddX, AddY
    Public nowDown As Boolean

    Public Sub ThreeDControl(Ctrl As _
    Control, nBevel, nSpace, bInset)

    PixX = Screen.TwipsPerPixelX
    PixY = Screen.TwipsPerPixelY

    CTop = Ctrl.Top - PixX
    Clft = Ctrl.Left - PixY
    CRgt = Ctrl.Left + Ctrl.Width
    CBtm = Ctrl.Top + Ctrl.Height

    ' Color used below:
    ' dark gray = &H808080
    ' white = &HFFFFFF

    If bInset Then 'inset border
    For i = nSpace To (nBevel + nSpace - 1)
    AddX = i * PixX
    AddY = i * PixY
    Ctrl.Parent.Line (Clft - AddX, CTop - _
    AddY)-(CRgt + AddX, CTop - AddY), &H808080
    Ctrl.Parent.Line (Clft - AddX, CTop - _
    AddY)-(Clft - AddX, CBtm + AddY), &H808080
    Ctrl.Parent.Line (Clft - AddX, CBtm + _
    AddY)-(CRgt + AddX + PixX, CBtm + AddY), &HFFFFFF
    Ctrl.Parent.Line (CRgt + AddX, CTop - _
    AddY)-(CRgt + AddX, CBtm + AddY), &HFFFFFF

    Next
    Else 'outset border
    For i = nSpace To (nBevel + nSpace - 1)
    AddX = i * PixX
    AddY = i * PixY
    Ctrl.Parent.Line (CRgt + AddX, CBtm + _
    AddY)-(CRgt + AddX, CTop - AddY), &H808080
    Ctrl.Parent.Line (CRgt + AddX, CBtm + _
    AddY)-(Clft - AddX, CBtm + AddY), &H808080
    Ctrl.Parent.Line (CRgt + AddX, CTop - _
    AddY)-(Clft - AddX - PixX, CTop - AddY), &HFFFFFF
    Ctrl.Parent.Line (Clft - AddX, CBtm + _
    AddY)-(Clft - AddX, CTop - AddY), &HFFFFFF
    Next
    End If

    End Sub

    Private Sub Command1_Click()

    If nowDown = False Then
    Call ThreeDControl(Command1, 1, 0, True)
    Command1.Width = 1215
    Command1.Height = 495
    nowDown = True
    Else
    nowDown = False
    Command1.Width = 1250
    Command1.Height = 525
    Command1.Refresh

    End If

    End Sub

    Private Sub Form_Activate()
    Call ThreeDControl(Command1, 1, 0, True)
    Command1.Width = 1215
    Command1.Height = 495
    nowDown = True
    Call Command1_Click

    End Sub

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width