Hello Dan,

  The basic problem of Laszlo modality implementation, from my
  experience, is that it makes really difficult to program some user
  interaction in an organized way. Consider traditional approach:

  do_smth();
  ask_user();
  if (user_said_ok) {
     do_smth();
  } else {
    say_good_bye();
  }

  At least the logic of the entire process is quite clear now. You can
  easily code a sophisticated algorithm in this way. In Laszlo,
  however, things are different. The code is split into multiple
  pieces (corresponding to individual event handlers), and, to make
  things worse, the state is not preserved!

  [algorithm starts]
  do_smth();
  ask_user();
  [method ends here]

  [on_ok event handler]
  do_smth();
  [/on_ok event handler]

  [on_cancel event handler]
  say_good_bye();
  [/on_cancel event handler]
  
  In each event handler you need to think more and more about what has
  happened in the past, what is the application state etc.

  Do you know a good or at least acceptable way to fight this problem
  in Laszlo? I was thinking about passing the state to doModal()
  function in a way like
  doModal({var1: var, var2: var2});
  and make dialog fire some event when closing passing two parameters:
   - this saved state
   - some kind of result code

  At least, the problem of state transition can be solved this way...
  Any thoughts about that?

DS> Ah, yes, the Java dialog idiom ;). Modal dialogs do not work this way in
DS> LZX.

DS> If you need to retrieve a value corresponding to what the user clicked,
DS> you can have the button's onclick method generate an event (or set the
DS> value, or call method that sets the value, etc.).


-- 
Regards,
 Michael                                   mailto:[EMAIL PROTECTED]

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to