TOPIC: 2 tabcontrols in 1 controller
#1878
2 tabcontrols in 1 controller 6 Months, 3 Weeks ago
Hi, if i have 2 tabscontrols in controller how to see who trigered SelectTab(i)? there is no source info in args
 
 
#1879
Re:2 tabcontrols in 1 controller 6 Months, 2 Weeks ago
You could wrap them each in a Controller and handle (and maybe re-Send) the messages.

But probably better to add a "source" argument to the Send's. This should be "named" (e.g. source: this) so it doesn't break any existing code.

I notice that one of the Send's already has a source argument.

It seems reasonable to add this to stdlib.
 
 
andrew
 
#1885
Re:2 tabcontrols in 1 controller 6 Months, 2 Weeks ago
Think i will make a controller, i dont like changing stdlib, i am afraid my changes will gone after upgrading to newer version. Maybe if I subclass it can be better. Anyway making a controller can clean up my code a bit :-D thanks...
 
 
#1886
Re:2 tabcontrols in 1 controller 6 Months, 2 Weeks ago
But if you send the changes to me, I will include them in the next version :-)
 
 
andrew
 
#1887
Re:2 tabcontrols in 1 controller 6 Months, 2 Weeks ago
OK next time maybe i change the stdlib :-D

Speaking of changes: i have issue with destructing of data in database depending on law (how long data allow to be kept). If i delete object from db it still keep history of change. I can remove history but then all history is gone. Can i remove history of only 1 object?
 
 
#1888
Re:2 tabcontrols in 1 controller 6 Months, 2 Weeks ago
But for TabControl i think change is:

Code:

TCN_SELCHANGE()
{
i = SendMessage(.Hwnd, TCM.GETCURSEL, 0, 0);
.Send("SelectTab", i);
return 0;
}



Becomes:
Code:

TCN_SELCHANGE()
{
i = SendMessage(.Hwnd, TCM.GETCURSEL, 0, 0);
.Send("SelectTab", i, source:this);
return 0;
}



Then can use source.Name and see who send tabchanges.
 
 
#1889
Re:2 tabcontrols in 1 controller 6 Months, 2 Weeks ago
I feel stupid! I started to wonder if we should add "source" automatically. Then I thought, "hey, maybe we already did that".

Sure enough, in the Send method in Control it adds source if it is not already there.

Code:

Send(@args)
    {
    if not args.Member?("source")
        args.source = this


One way to see all the arguments is to receive them with (@args) and then Print or Inspect args.

So your suggested change should be unnecessary (but it looked correct).

[I will answer your history question in a separate topic.]
 
 
Last Edit: 2010/02/07 18:01 By andrew.
 
andrew