IonicWind Software

IWBasic => The Roundtable => Topic started by: Allan on June 03, 2009, 07:46:39 PM

Title: Control Demo
Post by: Allan on June 03, 2009, 07:46:39 PM
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.

Title: Re: Control Demo
Post by: pistol350 on June 04, 2009, 06:41:21 AM
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 */
Title: Re: Control Demo
Post by: Ionic Wind Support Team on June 04, 2009, 08:09:46 AM
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.
Title: Re: Control Demo
Post by: pistol350 on June 05, 2009, 05:25:25 AM
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.
Title: Re: Control Demo
Post by: tbohon on June 10, 2009, 08:21:19 AM
Great job, Allan - thanks for sharing!!!

Tom