Current location: Hot Scripts Forums » Programming Languages » Visual Basic » ToolBar and ImageList


ToolBar and ImageList

Reply
  #1 (permalink)  
Old 01-17-06, 05:59 PM
Athono Athono is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ToolBar and ImageList

I am new to Visual Basic. So the differences between C++ and VB are striking to me. But even this seems like too much. Here is what I am talking about:

I got a project out of source safe and I started working with it.
The Graphics associated to an image list had been compiled into the project but the actual graphic files were missing.
So they appeared in the project at first but then the buttons associated with the image list went blank.
I thought all I had to do was to get the graphic image files and then reassign the image list and the toolbar. But NOOOOO. According to the book I have, once the image is set, you cannot change it and you will have to build the entire thing from scratch.

Is this right?

------------------------------

OK, so I went ahead and wrote down all the key names and other data associated with the image list and the button bar and I went ahaead and deleted them. I have made a back-up copy of the project in case I want to go return to the version before I did this.

But now, after inserting each bitmap into the ImageList, I right-clicked on the new Toolbar and choose Properties and assigned it the ImageList.

Now, aren't the images supposed to pop into the toolbar?

What am I doing wrong?
Reply With Quote
  #2 (permalink)  
Old 01-18-06, 10:04 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Hmm..... maybe you are going about doing this the wrong way. Here is what you need to do:

1- Go to "Projects - Components" in the VB6 Menu.
2- Check the "Microsoft Windows Common Controls 6.0" and hit OK.
3- Drag and drop an image list onto your form.
4- Right-Click on the image list icon and choose properties. A seperate popup screen will pop up as shown in the attached snapshot.
5- Click on the Images Tab.
6- Click on the "Insert Picture" or "Remove Picture" buttons respectively to add or remove images to your list.

I hope this answered your question.

On a different note, I noticed that you keep comparing C++ to VB constantly. My advice to you is to NOT compare the two with each other. Put aside your C++ knowledge, and learn VB as a brand new language (as if you were new to programming). VB6 has many limitations, most of which can be worked around with some patience. VB is not perfect (as you have already figured out). However, considering what it does offer and how easy it makes it for people to program, its a wonderful application. And believe me, back in 1998, VB 6.0 WAS an amazing product to have.
Attached Images
File Type: gif ImageList.gif (24.1 KB, 1967 views)
__________________
Reply With Quote
  #3 (permalink)  
Old 01-20-06, 04:15 PM
Athono Athono is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks!

I got the buttons (their graphic image) back to the toolbar.

And when you click on the buttons, the right VB code is executed through a switch statement, etc.

So I am just about there.

The only problem now is that when I click on a button, it does not stay clicked. Any idea why that is? I looked at the properties of the toolbar but I cannot find any sort of thing that suggests that a button should stay down once you click it.

In other words, when the toolbar comes up, the first button appears as being pressed down. And if a user clicks on any other buttons, he can do so, but once he let's go, the first button goes back to being the only one pressed down.
Reply With Quote
  #4 (permalink)  
Old 01-20-06, 09:53 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
If your buttons are regular command buttons, with images specified to them, each button will have two seperate images:

1- Select the button in question, right click on it and choose properties. The properties menu will open (if you don't have it open already).

2- Look for the following two properties:

Picture: Is the regular image you assign to the button.

DownPicture: Is the image that will show when you click on the button.

In order for the button to stay clicked, you will have to set the "Picture" property of the button to the image you are using for "DownPicture" property in your code.
__________________
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 01:15 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.