Re: [Fresco-devel] flyweighting the commands behind triggers

Nick Lewycky <[email protected]>
Newsgroups gmane.comp.video.fresco.devel
Message-ID <[email protected]>
Stefan Seefeld wrote:
> Nick Lewycky wrote:
> 
>> Even though the Command->execute function takes a CORBA::Any, there's 
>> no way to pass data to it through a button you've just created. In 
>> order to facilitate flyweighting of CommandImpls, I'd like to add a 
>> "payload" attribute to the Trigger that changes what the ToolKit 
>> passes in when it calls execute. At the moment, it just passes in a 
>> useless blank.
> 
> I'm not quite sure what you mean with 'flyweighting CommandImpls'. Are you
> thinking of executing each command 'type' as a single object, passing 
> different
> payloads to specify the actual context the command applies to ?
> You are not going to share an instance and then set the payload before each
> execution, are you ??
> A little use case (pseudo code, whatever) would probably help to clarify
> the advantages/disadvantages...

- create 8 by 8 grid
- create one Command, with ref to grid
- loop for each element in grid
  - create Trigger
  + set Trigger payload with grid index

--> When the user clicks a button, the Command will know which one.

Imagine implementing tabs. Clicking on each tab does basically the same 
thing, except that it needs to know which one was clicked on. You can 
either load the Trigger or create multiple Command objects.

I had working real code, but I'm in the process of refactoring it. If 
you want to see what I'm up to, just ask.

Nick Lewycky
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.