dynamically created event separation
szurilo
szurilo at sch.bme.hu
Sun Feb 3 08:33:38 PST 2008
O, i never thought i can simply add a number to my ID.:blush:
Well this is what i looked for, thank you all for you help.
Szurilo
Leslie Newell wrote:
>
> Don't make wx generate the Ids. IDs for the children of any window need
> to be unique but as long as you don't conflict with the predefined wx
> IDs (4999 - 5999), you can use anything you want. wxNewId() always
> starts from 0 so choose a number that will be well out of the way.
> Simply pick a base number and work from there:
>
> #define FIRST_ID (1000)
>
> for (int count=0; count<number_of_textcontrols; count++)
> {
> Chn_TextCtrl0[count] = new wxTextCtrl(this, count + FIRST_ID,....
> }
>
> When you receive the event, you now know that ID 1000 equates to
> Chn_TextCtrl0[0] , 1001 equates to Chn_TextCtrl0[1] and so on.
>
> Les
>
>
> szurilo wrote:
>> Ok, than what is the solution if i want some control that created
>> dynamically
>> and if the user press <enter> in any of them my event handler know which
>> one
>> is the sender.
>> I mean i run my (client) program, the server tells it create 4
>> wxTextCtrl.
>> The client create them and Connect() the event handler function, than it
>> should assign a number for example 3 if the user press the <enter> in the
>> 3th wxTextCtrl.
>> getId() only tell a number(ID) that isnt help me bec. this number could
>> be
>> any number like i told you it was 121 when i check it in my program
>> before.
>>
>> Szurilo
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
>
--
View this message in context: http://www.nabble.com/dynamically-created-event-separation-tp15252679p15255157.html
Sent from the wxWidgets - Users mailing list archive at Nabble.com.
More information about the wx-users
mailing list