Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 OnFocus() 1

Status
Not open for further replies.
Joined
Jun 30, 2003
Messages
196
Location
GB
This is tricky to explain but ill give it a go.

Im developing a mobile phone user interface. when in the main menu i want to allow my user to navigate from one command button (or icon) to another, they can go left, right, up or down depending on direction of the key thye press. so bassically the form will open up and focus will be set to one specific icon, when they press left focus will move to the icon to the left of the starting position.

My question how do i implement this to move focus?
and when focus is moved to an new icon how do i change that icons (command button) properties say to increase it in size?

if more clarification is needed please ask.
 
Cant see anything wrong here, but the debugger should tell you what is happening.

Dry running this, I see the form load sets iCurrenticon to 5, and sets the backcolor to &h0
(Use SetIconState(5,1) in case you decide to change what the seticonstate actually does)

SO button 5 is now red.
You click down.
this happens:

Call SetIconState(iCurrentIcon, 0)
..making button 5 look grey

iCurrentIcon = arrDOWN(iCurrentIcon)
..making iCurrenticon equal to 8

Call SetIconState(iCurrentIcon, 1)
..making button 8 go red.


So if you don't see that happen, trace it through with F8

If it still does not change, try putting me.refresh at the end of SetIconState, and checking the value of the Autoredraw property on the form.
 
ps - you may not know it, but I have got you writing the core of a text based adventure game here..
Think N, S, E, W and you have it...
 
Hi jeff i tryed the debugger and it all seemed to work logically but i still had the same problem, so i put in the Me.Refresh code and it now works PERFECTLY!!!!!

Thanks so so much for your help, out of curiosity why would the refresh statement make it work, why dont you think it worked proprly without that?

And yes i see what you mean, the functionality i have acheived could be used to control the game.

thanks once again.

 
Actually jeff you may be able to help with a related problem as well.

So i can now use directional keys to move around nine icons, when it moves to another i con that icon looks selected and the old icon returns to a non-selected appearance.

But also on my form i have a select button, which i want to allow my users to press when they have selected the correct icon, and depending upon what icon is highlighted (or looks selected) when they press select an appropriate form will open.

So my question how do i on click of the the softkey get the program to recognise which icon is highlighted and then to open the appropriate form related to the selected icon.

hope this is understandable, it makes sense to me but thats not saying much.

cheers
Dan
 
So simple its not true.

By clicking select, or pressing 'the softkey', the form must react according to which icon is selected.

The form already 'knows' which icon is selected - this is the variable iCurrentIcon.

So on the click/press, you just call a subroutine that launches the right form, using a Select Case statement.

Select iCurrentIcon

case 1:
formicon1.show
case 2:
formicon2.show
case 3:
formsomethingelse.show
case else
'you get the idea
end select
 
cheers jeff your a star! sometimes i look for a harder solution and miss the simple ones. cheers
 
Hi jeff me again. got a new one for ya if ya dont mind helping out again.

So bassically using the same system as we have talked about previously using the directional keys to navigate, but this time with a little difference.

On one of my forms i want the user to be presented with a list of options (like that on a mobile phone) but of course not all the options can be displayed at once. I want the system to allow the user to press up and down to scroll through each option, changing its apperance depending if currently selected or not (this bit is ok i understand how to do that). But as i said not all the options can fit on screen, so when the user clicks down whilst the last option is highlighted the options below should beocome visible and all the options move up, therfore the top option should dissapear of screen.

I hope this makes sense.

I was hoping i could use a list box but not sure this would allow me to use the directional keys to navigate through the options and change there appearance, also not sure if i could create the functionality described above whereby when down is pressed on the last displayed option another one beocomes visible and the top one dissaperas. What do you think, any ideas

Thanks again Dan
 
A listbox is what you need.
I have to say that I dont really know why you are jumping through all these hoops to create this kind of user interface.

For example: earlier we discussed moving about from icon to icon by having the user click on directional buttons or shortcut keys.
And I still dont know why. What was wrong with just clicking on the icons themselves?

Here, and in another post, you have asked how to move up and down the selection in a list by having two buttons to move the selection.

Again, I dont understand why.
Once the listbox has the focus, you can use the normal up and down keys to move the selection.
Or you can click on the item you want with the mouse.


By the way, I wouldn't keep adding things to this topic.
I've written you something to do the move focus problem.
If you now have a problem doing another kind of task, it is better off in a new topic.
 
ok jeff thanks i have seen you other post. But just to answer your questions.

I am researching usability and accessability of mobile phones. I am in the process of creating a prototype mobile phone interface (limited functionality) so i need to replicate how the user would intercat with the interface without a mouse and can only use the keys on the keypad.

The interface i am designing is being written in VB6 using appforge add in which means it will be able to be ported to a mobile phone. My aim is to allow the users to only be able to navigate the interface by using the keys i supply and not by directly interacting with the icons them selves with a mouse or touch screen.

Hope that clears it, i can see why you would think i was mad doing what im doing but it is the name of research.

thanks for all your help and i will take your advice about the new thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top