Login






Lost Password?
No account yet? Register
Home arrow Forum
Suneido User Forums
Welcome, Guest
Please Login or Register.    Lost Password?
2 tabcontrols in 1 controller (1 viewing) (1) Guest
Go to bottom Favoured: 0
TOPIC: 2 tabcontrols in 1 controller
#1878
Peter (User)
Posts: 76
User Offline Click here to see the profile of this user
2 tabcontrols in 1 controller 7 Months, 1 Week ago  
Hi, if i have 2 tabscontrols in controller how to see who trigered SelectTab(i)? there is no source info in args
 
Logged Logged  
  The administrator has disabled public write access.
#1879
andrew (Admin)
Admin
Posts: 693
User Offline Click here to see the profile of this user
Re:2 tabcontrols in 1 controller 7 Months, 1 Week 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.
 
Logged Logged  
 
andrew
  The administrator has disabled public write access.
#1885
Peter (User)
Posts: 76
User Offline Click here to see the profile of this user
Re:2 tabcontrols in 1 controller 7 Months 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...
 
Logged Logged  
  The administrator has disabled public write access.
#1886
andrew (Admin)
Admin
Posts: 693
User Offline Click here to see the profile of this user
Re:2 tabcontrols in 1 controller 7 Months ago  
But if you send the changes to me, I will include them in the next version :-)
 
Logged Logged  
 
andrew
  The administrator has disabled public write access.
#1887
Peter (User)
Posts: 76
User Offline Click here to see the profile of this user
Re:2 tabcontrols in 1 controller 7 Months 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?
 
Logged Logged  
  The administrator has disabled public write access.
#1888
Peter (User)
Posts: 76
User Offline Click here to see the profile of this user
Re:2 tabcontrols in 1 controller 7 Months 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.
 
Logged Logged  
  The administrator has disabled public write access.
#1889
andrew (Admin)
Admin
Posts: 693
User Offline Click here to see the profile of this user
Re:2 tabcontrols in 1 controller 7 Months 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.]
 
Logged Logged  
 
Last Edit: 2010/02/07 18:01 By andrew.
 
andrew
  The administrator has disabled public write access.
Go to top