April 29, 2024, 03:04:11 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Control Demo

Started by Allan, June 03, 2009, 07:46:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Allan

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.


pistol350

June 04, 2009, 06:41:21 AM #1 Last Edit: June 04, 2009, 06:46:04 AM by pistol350
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 */
Regards,

Peter B.

Ionic Wind Support Team

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.
Ionic Wind Support Team

pistol350

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
'...
'...
ENDIF


Thank you Paul.
Regards,

Peter B.

tbohon

Great job, Allan - thanks for sharing!!!

Tom
"If you lead your life the right way, the karma will take care of itself ... the dreams will come to you."  -- Randy Pausch, PhD (1961-2008)