codemorphis.com Forum Index codemorphis.com
Software development: pure and simple.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Setting Focus

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    codemorphis.com Forum Index -> Visual Programming Forum
View previous topic :: View next topic  
Author Message
mforkner



Joined: 04 Aug 2004
Posts: 78

PostPosted: Fri Nov 12, 2004 1:27 pm    Post subject: Setting Focus Reply with quote

Hi,

I have hit a snag in setting the focus of an object on a windows form. I did search Help & Component Tray, but can't find a topic on this subject. Please excuse me if it is there. Embarassed

I would like to know how to set focus on a particular button or text input box, etc..

Thank you,
Michael Forkner
Back to top
View user's profile Send private message Visit poster's website
CodeMorphis



Joined: 02 Dec 2003
Posts: 252

PostPosted: Fri Nov 12, 2004 4:11 pm    Post subject: Reply with quote

Michael,

The functionality you seek is served by the "Set focus" service of the "UI Component Interface" found in the Windows tab of the Component Tray.

To use the service, simply select the target UI component and the Windows form that contains it.

The "Set focus" command was added as part of Update 1.1.1 which is why it currently is only found in the "UI Component Interface" component - the UI Component Interface controls properties common to all UI components. Eventually the "Set focus" service will appear in every UI interface component.

Hope that this helps.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
michaelforkner



Joined: 04 Aug 2004
Posts: 12

PostPosted: Fri Nov 12, 2004 6:41 pm    Post subject: Set Focus Reply with quote

Hello,

Yes, I did find that service. Thank you. I zipped right past it last night while looking. Sorry. However, perhaps I'm using the wrong terminology. I want to make the cursor be in the textbox of my choosing, or have a button selected as a default of my choosing. I have tried to do this using the set focus of the UI Interface component, but to no avail. Perhaps you could reply with a proper method ( no need for screen shots ), or correct me as to how the set focus actually works with a windows form.

Thank you,
Michael Forkner
Back to top
View user's profile Send private message Visit poster's website
CodeMorphis



Joined: 02 Dec 2003
Posts: 252

PostPosted: Fri Nov 12, 2004 8:33 pm    Post subject: Reply with quote

That is the correct service to use.

The Windows form needs to be displayed when calling the service so that the visual update can be effected.

Here is a simple program example that demonstrates how to set focus to a textbox:



Note the edit cursor that appears in the textbox. You can see that the "Set focus" service is selected on the UI Component interface. The arguments of the input data ports of the component specify the Windows form and the textbox UI component.

Here is the link to the above program:

http://www.codemorphis.com/articles/ans_111204/focus.vpd

Try selecting one of the buttons for the argument of input data port 1 of the UI Interface component to see how to set focus to the button.

Another thing you might want to experiment with is placing the UI Interface component inside the windows event loop:



If you run the program you can click somewhere in the window not occupied by a UI component, for instance, and for each mouse click the set focus service will be called. Before each click you make, try changing the UI component argument in input data port 1 of the UI Interface. You will see the focus change to your selected UI component.

This is another example of experimenting with your program in real-time without the need to stop your program. In a traditional development approach, for each experimentation change you would have to exit the program, return to the IDE to make changes and then re-run the program. With Synopsis, you can avoid all of this waterfall development approach and get instant feedback!

Here is the link to the modified program:

http://www.codemorphis.com/articles/ans_111204/focus2.vpd


Please don't hesitate to ask if you need further explanations.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
michaelforkner



Joined: 04 Aug 2004
Posts: 12

PostPosted: Fri Nov 12, 2004 11:35 pm    Post subject: Thank You Reply with quote

I sure wasn't expecting the screen shots and vpd's , so thank you very much. This was exactly what I was trying to do.

Regards,
Michael Forkner
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    codemorphis.com Forum Index -> Visual Programming Forum All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group