Solved

Image to follow focus

Posted on 2000-03-22
7
159 Views
Last Modified: 2010-05-02
Hello all.  I am programming a user app that requires the user to select from several different options and depending on the option selected the form will take shape.  The positioning of the text boxes and labels is such that the form is somewhat confusing to follow.  So what I would like to use is sort of a follow the bouncing ball kind of thing where the user would do simply that follow a ball or pointer from text box to combo and so on as each of the controls gets focus.  I would like the image to appear on the side of the control or label....I figured this is an easy question for most of you, Thanks for the help.......
0
Comment
Question by:johnmhat
7 Comments
 
LVL 1

Expert Comment

by:bpoff
Comment Utility
A simpler way might be to set the text color of the label for each control as it becomes active.

Put something like this in each control's GotFocus event:

ControlName.ForeColor = vbRed


In the LostFocus event, put this:

ControlName.ForeColor = vbBlack


This helps you deal with problems where there might not be enough room to show some sort of image, yet gives the user the visual feedback to help them see what's going on.
0
 
LVL 3

Accepted Solution

by:
Gordonp earned 50 total points
Comment Utility

First you'll need your image in a picture box.

picIndicator.Picture = LoadPicture(<Filename>)

then in the GotFocus event of each control

Private Sub <A Control>_GotFocus()

   With <A Control>
   picIndicator.Move .left - picIndicator.width,.top
   End With

End Sub

As Each control gets focus, the indicator picture will appear at the left of the control with focus.

You can adjust the .move parameters to make the indicator appear above/below/to the right of the control

Hope this helps

Gordon
0
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
Or use a shape control for the "bouncing ball."
Option Explicit

Private Sub Check1_GotFocus()
    BounceBall
End Sub

Private Sub Combo1_GotFocus()
    BounceBall
End Sub

Private Sub Command1_GotFocus()
    BounceBall
End Sub

Private Sub Form_Load()
    Shape1.Width = 100
End Sub

Private Sub Text1_GotFocus()
    BounceBall
End Sub

Sub BounceBall()
    Shape1.Move ActiveControl.Left - Shape1.Width, _
        ActiveControl.Top, 100, ActiveControl.Height
End Sub
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 3

Expert Comment

by:Gordonp
Comment Utility
Would it not be better to reorganise your form so the progression was more logical, or even to have several forms accessed sequentially.

If your form is laid out in such a manner that it requires help to follow the flow, then change the layout, rather than add "features" to lead a user through it.

Gordon
0
 
LVL 3

Expert Comment

by:jjmartin
Comment Utility
I would agree with Gordonp, visit this site for some suggestions:

http://iarchitect.com/shame.htm
0
 
LVL 4

Expert Comment

by:PBuck
Comment Utility
I had to do something like this once ... I decided to use a label [>>>](but the code should work just fine).

I would make sure all your Textboxes are an array (just chance the index property starting with 0 to however many you have).  What I did was created a label with [>>>] to use as a pointer.  Instead place the imagebox where you would like the image to appear making sure it has the same index as the textbox.

Set all your imagebox visible properties to FALSE.

Use the below code for your Textbox Gotfocus

Private Sub txtDIALOG__GotFocus(Index As Integer)
Dim X as Integer
    For X = 0 To 20 'How many Textbox/Image you have??
        Image1(X).Visible = False
    Next X
    Image1(Index).Visible = True
End Sub

*Whichever textbox has the focus, the appropriate image will appear next to it and all others will turn invisible.

Hope this is useful.  Good Luck!
0
 

Author Comment

by:johnmhat
Comment Utility
Thanks for the help...I think I will go back and reorganize the form...It is a case of a project that was started about 6mos ago and now I know alot more about the language...But it is always fun to learn new methods, there is so much...Thanks again
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now