forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Combo Box Edit

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Fri Dec 16, 2005 12:05 pm    Post subject: Combo Box Edit Reply with quote

Greetings,
I'm using a COMBO box to pre-load text from a list but also allow the user to type in their own text. I have a maximum length of 40 characters.
When the user clicks a button to submit the text I warn them if they've typed too many characters.
I would like to have a status display showing the number of available characters remaining while they're typing but can't seem to figure out how to do this without continuously looping. the COMBO control has CLICK and EXIT available but neither of these tells me when the user starts typing.
Is there some reasonable way to do this that I'm overlooking?
Perhaps some way to tell me that this particular box has focus?
Thanks.....
.........David
Back to top
View user's profile Send private message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1567

PostPosted: Fri Dec 16, 2005 3:51 pm    Post subject: Reply with quote

If I recall correctly you can add the CHANGE style to an edit box where it will create a :EDIT1CHANGE event on any changes made within the edit box.

Also you can use the api below to limit the number of characters that can be entered into an editbox:

Code:
%A = @sendmsg(@win(~EDIT1),$0C5,40,0)


Change EDIT1 to your editbox name, and change 40 to the number of characters you want to limit the edit box to. A user will not be able to enter any more text then the limit you set, also it will beep on the computer if they attempt to type more data into the editbox.

You can find more api messages with the api reference manual:
http://www.vdsworld.com/download.php?id=331

Also there are a couple other good api reference files here on vdsworld that are very helpful too.


Last edited by PGWARE on Sat Dec 17, 2005 6:44 pm; edited 3 times in total
Back to top
View user's profile Send private message
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Fri Dec 16, 2005 4:42 pm    Post subject: Reply with quote

Thanks, that's exactly what I needed.
It didn't work at first but I took your suggestion and reads the API help file and discovered that the parameter is $0141 for a COMBO box.

Thanks again, we're back in business.
...........David Very Happy
Back to top
View user's profile Send private message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1567

PostPosted: Sat Dec 17, 2005 6:45 pm    Post subject: Reply with quote

Oops sorry about that, was a bit early in the morning Smile You said combobox while I was giving you information for edit boxes.

Good to hear you got it working though, I'm not sure if that CHANGE style will work for a combobox but you can give it a try and see if it does.
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Mon Mar 27, 2006 2:36 pm    Post subject: Reply with quote

I just came across this thread when searching for something else and I can't find the CHANGE style for an editbox documented. It doesn't seem to work in VDS5 - is there really such a style?

If not, it would be a great addition to VDS. I think elements need to have as many Styles as possible that generate events. (OnEnter, OnLeave, OnChange), etc.

_________________
Joe Floyd
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 27, 2006 3:44 pm    Post subject: Reply with quote

jwfv,
There is an EXIT style that you can apply to an edit box. This style fires a ELEMENTNAMEEXIT event when the user tabs away from the edit box.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Mon Mar 27, 2006 3:49 pm    Post subject: Reply with quote

Yeah - I use the EXIT style quite a bit to do data formatting, etc. But I had never seen the CHANGE event mentioned, and I don't think it is in VDS. (Would be nice - only fires if the info in the box changes. One could simulate the same thing by checking vs. a variable on an EXIT event, but for a form that has lots of edit fields, it might get complicated.)

I'm just trying to think of a way to show a dialog with lots of edit elements, and then when a certain event happens (close button, "save" button, etc.) - VDS could somehow tell me which have changed.

_________________
Joe Floyd
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 27, 2006 4:06 pm    Post subject: Reply with quote

jwfv,
You could send the edit boxes a EM_GETMODIFY $B8 message.

Code:
%A = @sendmsg(@winexists(~EDIT1),$B8,0,0)
if @Equal(%A,1)
  Warn EDIT1 has changed.
Else
  Info Thank you for not changing EDIT1
End

Exit


I don't think VDS could capture these Notification messages but if so you could hook these messages EN_CHANGE $300 or EN_UPDATE $400.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Mon Mar 27, 2006 4:37 pm    Post subject: Reply with quote

Thanks for the tip, but that is a little over my head. And from what you were saying, it sounds like VDS wouldn't capture those windows messages anyway...?

Well, who knows - maybe in the future.

_________________
Joe Floyd
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 27, 2006 4:48 pm    Post subject: Reply with quote

jwfv wrote:
Thanks for the tip, but that is a little over my head. And from what you were saying, it sounds like VDS wouldn't capture those windows messages anyway...?

Well, who knows - maybe in the future.


Please read my post again.

VDS would only have an issue with the notification messages not the EM_GETMODIFY message.

You wanted to know how to detect if any of your edit boxes changed when your program closed which means you should be able to send each of your editboxes a EM_GETMODIFY message and they should place a 1 or 0 in the variable %A. The number 1 is for true which means the edit box changed. The number 0 means the edit box did not change.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Mon Mar 27, 2006 4:55 pm    Post subject: Reply with quote

Wow! That works great!

This could be very helpful because I have lots of data entry/display/verification in my programs, and with a simple routine I can see if anything has changed and needs to be saved, verified, etc.

Thanks for the tip!

Am I understanding you correctly, though - Windows also can send notifications out that say that something has been changed in an edit (as it happens), but VDS lacks the ability to pick up these Windows notifications?

_________________
Joe Floyd
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 27, 2006 5:43 pm    Post subject: Reply with quote

jwfv wrote:
Am I understanding you correctly, though - Windows also can send notifications out that say that something has been changed in an edit (as it happens), but VDS lacks the ability to pick up these Windows notifications?


No, VDS handles the Windows notifications like any Win32 GUI application would. I just don't think that the command OPTION MSGEVENT can handle notification messages like the EN_CHANGE $300 or EN_UPDATE $400. I just have not tried it is all Wink

Here is some more information for you. These notification messages are sent to the editboxes parent window as a WM_COMMAND $111 message. So you would have to point the OPTION MSGEVENT to the WM_COMMAND message. Everytime you got a WM_COMMAND message you would have to get the HIWORD value from the wParam to see if it was EN_CHANGE or EN_UPDATE then look at the lParam to get the Window ID (i.e. window handle) to see if it matches one of your Edit boxes Window ID's. I guess you could use Snarling Sheeps Bitwise VDS 5 functions to get the HIWORD from the wParam take a look at his post... http://forum.vdsworld.com/viewtopic.php?t=1860&highlight=


Code:
# To get the HIWord of a DWORD number
%%SomeNumber = 12345678
%%Hiword = @SSBitAnd(@SSBitRShift(%%SomeNumber,16) ,@SSHex2Dec($FFFF))
# To get the LOWord of a DWORD number
%%Loword = @SSBitAnd(%%SomeNumber,@SSHex2Dec($FFFF))
#To get the HIByte of a WORD number
%%HIByte = @SSBitAnd(@SSBitRShift(%%Hiword,Cool,@SSHex2Dec($FF))
#To get the LOByte of a WORD number
%%LOByte = @SSBitAnd(%%Hiword,@SSHex2Dec($FF))
#To make a WORD from 2 BYTE values
%%WORDVal = @SSBitOr(%%LOByte,@SSBitLShift(%%HiByte,Cool)
#To make a DWORD from 2 WORD values
%%DWORDVal = @SSBitOr(%%Loword,@SSBitLShift(%%Hiword,16))



I though in the Loword Hibyte, Lobyte, MAKEWORD and MAKELONG just for good messure.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 27, 2006 7:21 pm    Post subject: Reply with quote

jwfv,
I just tried to hook the WM_COMMAND message with OPTION MSGEVENT. Unfortunately OPTION MSGEVENT does not see WM_COMMAND messages Confused I don't know if VDS has an internal list of Message ID's that it understands or what. I guess you will have to wait for GadgetX to come out. GadgetX can hook WM_COMMAND messages and has the functions needed to handle the wParam's and lParam's properly.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Mon Mar 27, 2006 7:26 pm    Post subject: Reply with quote

Cool - anxiously awaiting it.
_________________
Joe Floyd
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
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
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group