Control Demo - Uses an Edit Control to type in names that are to be added to a ListBox.
After typing in a name click Add Name Button or press the Return Key to put the name from the Edit Control into the ListBox.
After the name is entered into the ListBox the Edit Control is cleared and the Focus is set to the Edit Control ready for the next name to be entered.
To Delete a name from the ListBox select a name in the ListBox and click the Delete Name Button and the name will be removed.
When program starts a file is opened and the saved list of names are read into the ListBox.
When the program is closed the list of names in the ListBox are Saved to the File.
Hi Allan!
Nice example.
I wonder where you tell the program to respond to "Return" key press.
I don't find it.
I rather expected to see something under the code below but nothing.
Could you help me see clearer please.
CASE EDIT_NAME
/* respond to edit notifications here */
The button BUTTON_ADDNAME was created with the default button style. Which causes windows to press it when you press the enter key.
From the users guide:
@CTLBTNDEFAULT
Identifies this as the default push button in a dialog
Allan used the gui designer to create his dialog, but if you look at the styles for the buttons:
CONTROL Main,@SYSBUTTON,"Add Name",180,74,139,28,0x50018001,BUTTON_ADDNAME
CONTROL Main,@SYSBUTTON,"Delete Name",180,115,139,28,0x50018000,BUTTON_DELETENAME
@CTLBTNDEFAULT = 1 So he could have done it like so:
CONTROL Main,@SYSBUTTON,"Add Name",180,74,139,28,0x50018000 | @CTLBTNDEFAULT ,BUTTON_ADDNAME
CONTROL Main,@SYSBUTTON,"Delete Name",180,115,139,28,0x50018000,BUTTON_DELETENAME
Paul.
QuoteThe button BUTTON_ADDNAME was created with the default button style. Which causes windows to press it when you press the enter key.
OK.I see clearer now.
I did not think it could work like that also.
I rather thought it was
necessary to write something like this anyway.
CASE @IDCONTROL
SELECT @CONTROLID
CASE EDIT_NAME
/* respond to edit notifications here */
IF @NOTIFYCODE = @ENENTERKEY
' User pressed ENTER key, so do something here
'...
'...
ENDIFThank you Paul.
Great job, Allan - thanks for sharing!!!
Tom