visual studio 2013 - Alter properties of specific event "sender" in C++/CLI Windoes Form without switching through them all -


so, have form lot of numeric , down fields, each associated label describes "unity system" of field (like, m/s, ft, hp, , on). made labels clickable, unity system of each field can changed user, appropriate numeric value.

ok, cast clicked label data determine witch 1 clicked , calculations have done. done, need change label text, 1 clicked, , anyone....

the ideal case, this:

string^ labelname = ... cast ... sender ... -> name (or other property identify sender, tabindex) 

this ok, can cast sender, identify it, , right thing it. then, have change sender in form, don't know it, need (ideally):

this -> labelname -> text = .....  

obviously, doesn't work this. can me?

there must magical breaking head around problem, , take sleep , think else. after manage solve problem considerably easy.

to more specific, in form there many sets of: clikable label containing unity system, numericupdown control value, , hidden textbox multiplier, used conversions 1 system other. not best arrangement, it's now. so, 1 solution found (tb = textbox, nud = numericupdown):

first, cast relevant controls (and not property of them), , cast other ones come right after clicked label, use discovered (by me) method: getnextcontrol(), this:

label^ thislabel = safe_cast< label^ >( sender ); // clicked label numericupdown^ thisnud = safe_cast< numericupdown^ >( getnextcontrol ( thislabel, true ) ); // contains numeric value, , comes right after label textbox^ thistb = safe_cast< textbox^ >( getnextcontrol ( thisnud, true ) ); // hidden field 1 multiplier conversions 

after that, manipulations needed values , other properties. , final results , other data in hand, can (so simply) like:

thislabel -> text    = u[ ]; thisnud   -> maximum = system::convert::todecimal( maximum / m[ ] ); thisnud   -> value   = system::convert::todecimal( vnow  / m[ ] ); thistb    -> text    = system::convert::tostring ( m[ ] ); 

i couldn't believe work when decided try. ideal case mentioned above. suposes 3 controllers tabindexed 1 after other....

hope helpfull other newbie me!


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -