passing state arguments to an event is very common. I'm not sure what else
you're asking here.

I can tell you that you should NOT be naming your classes "window" "alert"
and "confirm". These are native objects and methods that you don't want to
overwrite. Esp. window.



On Sat, Nov 7, 2009 at 4:44 AM, Rolf -nl <[email protected]> wrote:

>
> Yes, but I do need a callback on the close of a dialog/stickywin. I
> already have a real simple dialog class for this project (stickywin is
> a bit too much), but it works in a similar way.
>
> I was wondering if I could use one callback function that receives the
> file element and a true/false boolean depending on the result/button
> click from the confirm..
> The callback on close is needed to continue with the queue.
>
> So the default could be (with delete set to flase as protection):
>
> confirm: function(title, message, callback) {
>  new window({
>    ..
>  }).addEvents({
>    confirm: callback,
>    close: callback
> });
>
> new confirm('myTitle', 'myMessage', this.deleteFileConfirmCallback.
> (false, file));
>
> deleteFileConfirmCallback: function(confirmDelete, file) {
>  if(!$defined(confirmDelete)) confirmDelete = false;
>  console.log('confirmDelete: ', confirmDelete);
>  console.log('file: ', file);
>  //continue with possible queue
>  this.queue.dequeue();
>  this.queue.doNext();
> }
>
> onConfirm the callback should receive a true setting for the variable
> confirmDelete and the file, while onClose the callback in its default
> way is ok (confirmDelete = false)
>
> I could put in a callbackOk and callbackCancel in the confirm
> function, but, if i could re-set one of the arguments (the first one
> in this case) in the callback function call I wouldn't have to.
>
> Does this make sense? ;)
>
>
> On Nov 7, 1:54 am, Aaron Newton <[email protected]> wrote:
> > stickywin has a hide event. it is fired whenever the window is set to
> > display: none. that's all you should need.
> >
> >
> >
> > On Fri, Nov 6, 2009 at 4:47 PM, Rolf -nl <[email protected]> wrote:
> >
> > > Right. So I have a simple queue class now.
> > > I was playing with stickywin and wondered if it has a callback
> > > functionality for the close button? E.g. to check the queue..
> > > I was having some issues with a simpler dialog class I created that I
> > > fired a 'close' event when it hides. The close event could handle a
> > > callback. However, if you would confirm/press OK in the dialog it
> > > would have to execute the callback, but should also close.. which in
> > > turn fires the close event which triggers a callback as well :) dohh
> >
> > > On Nov 6, 8:45 pm, Aaron Newton <[email protected]> wrote:
> > > > var alertMsg = function(msg) { alert(msg) };
> >
> > > > var alerts = [];
> >
> > > > alerts.push(alertMsg.pass('hi'));
> > > > alerts.push(alertMsg.pass('there'));
> >
> > > > alerts.each(function(fn) {
> > > >   fn();
> >
> > > > });
> > > > On Fri, Nov 6, 2009 at 11:39 AM, Rolf -nl <[email protected]>
> > > wrote:
> >
> > > > > I didn't know you could put function in an array... or maybe I did
> but
> > > > > wasn't aware of it. I will investigate it.. maybe it's already done
> > > > > inside of mootools or on places I haven't noticed it. Any examples?
> >
> > > > > Btw- 100 confirmation dialogs for 100 file delete actions is
> ofcourse
> > > > > a bit ridiculous ;), but it's a simple way of explaining what's the
> > > > > case and what has to be done.
> >
> > > > > On Nov 6, 6:16 pm, Aaron Newton <[email protected]> wrote:
> > > > > > I agree that one popup for all the files is ideal, but if you
> want to
> > > > > prompt
> > > > > > for each one (which could be annoying) I would push functions
> into an
> > > > > array.
> > > > > > The function would contain the logic to show the confirmation and
> > > send
> > > > > the
> > > > > > ajax request to delete the item and then call the next function
> in
> > > the
> > > > > array
> > > > > > if there is one.
> >
> > > > > > On Fri, Nov 6, 2009 at 8:12 AM, Nathan White <
> > > [email protected]
> > > > > >wrote:
> >
> > > > > > > What if you create a deleteQueue array in your class. Inside
> the
> > > onDrop
> > > > > > > event you set a delay/timeout for something short like 10 or 20
> ms.
> > > You
> > > > > > > store the delay in a variable. Before the delay put
> > > > > $clear(this.delayDrop);
> > > > > > > you should then be able to handle all in whatever way you like.
> You
> > > > > could
> > > > > > > even have a dialog with all files with check/uncheck all
> options
> > > for
> > > > > > > increased usability.
> >
> > > > > > > On Nov 6, 2009, at 8:01 AM, Rolf -nl <[email protected]>
> > > wrote:
> >
> > > > > > >> Working on a file manager where I can select multiple files
> and
> > > drag
> > > > > > >> them to a trash can. I have to add functionality to ask a
> > > confirmation
> > > > > > >> for each file gets deleted. onDrop of a file an event is fired
> > > which
> > > > > > >> triggers the deleteConfirm function in the file manager class.
> The
> > > > > > >> deleteConfirm shows a (modal) dialog (could be a stickywin as
> > > well)
> > > > > > >> that asks confirmation for that particular file.
> >
> > > > > > >> At the moment all onDrops ofcourse fire at the same time, or
> real
> > > > > > >> quick after each other. So this results in multiple dialogs.
> You
> > > only
> > > > > > >> see one, because they are all centered positioned on screen. I
> > > create
> > > > > > >> one mask/body overlay a check before creating the modal dialog
> if
> > > one
> > > > > > >> exists already.
> >
> > > > > > >> I rather queue this so that the deleteConfirm only starts when
> a
> > > > > > >> dialog is closed (either with Ok or Cancel) and then
> > > create/display a
> > > > > > >> new dialog.
> >
> > > > > > >> Does anyone know a way to create some sort of queue after the
> > > dropped
> > > > > > >> event is fired from the drag (which triggers, in case
> destination
> > > is
> > > > > > >> trashcan my deleteConfirm function). Something like chain...
> >
> > > > > > >> This way I could also do a "cancel all" from a dialog so it
> skips
> > > the
> > > > > > >> rest of the possibly 40 dialogs that ask for some sort of
> > > > > > >> confirmation ;)
> >
> > > > > > >> Thanks for any input
>

Reply via email to