.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 16th, 2003, 09:34 AM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
Accept Buttons in Vb.Net for a GroupBox ?

is it possible to create or make a way to have a Accept Buttons in a GroupBox ?

There is a property for a Frame where you can set a button to be the default Accept Buttons, that's mean each time you press enter in the frame it will go to this button.

My problems is that the Enter need to work only for a certain groupbox and not the entire frame. I have a groupbox where the objects in it are generated custom and change often, but I need to be able to press enter and go directly to this button.

I would like to know if there is a way to make that easily ?
There isn't a KeyDown property for the groupbox either.

Does I need to add a property or new code to a new class of objets that would be added to the groupbox ? then my problem will be to make two communicate with each others.
__________________

Reply With Quote
  #2  
Old September 16th, 2003, 12:40 PM
Wingman Wingman is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Bavaria, Germany
Posts: 140 Wingman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 41 sec
Reputation Power: 11
That's a HTML limitation, one form can only contain one default (the first if not otherwise specified) submit button.

But you can cheat with javascript :-)

The attached file contains a html file with 3 fieldsets (groups) with 1 textbox and 3 buttons (Buttons 1 - 3). If the first textbox has the focus and you press enter, button1 will be clicked, in the second button two and in the third button third.

This example handles the keydown inside the fieldset tag.
Code:
<fieldset id="Group<x>" onKeyDown="fnKeyDown(this)">
  ...
</fieldset>

Every time you press a key while a fieldset (or a child node of it) has the focus the javascript function "fnKeyDown" will be called.

Because the function is called on *every* click and we just want to handle "enter" we quit if your keyCode is not 13 (== linefeed).
Code:
if (event.keyCode != 13)
  return;


Inside this function we check who clicked us and then call the button depending which group has the focus.
Code:
if (group.id == "Group1") {
  document.getElementById("Group1Button1").click();
} else if (group.id == "Group2") {
  document.getElementById("Group2Button2").click();
} else if (group.id == "Group3") {
  document.getElementById("Group3Button3").click();
}

Hope this helps you...
Attached Files
File Type: html test.html (2.0 KB, 772 views)

Last edited by Wingman : September 16th, 2003 at 12:43 PM.

Reply With Quote
  #3  
Old September 16th, 2003, 12:50 PM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
ok, thank you for your answer. Doesn't help me but it's tell me what I tought before !

I just can't do it like that !

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Accept Buttons in Vb.Net for a GroupBox ?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap