Thread Rating:
  • 413 Vote(s) - 2.81 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sonntag MVC without strings or name
08-08-2011, 10:42 PM,
#3
RE: Sonntag MVC without strings or name
Do you mean we should not use strings as key things?
Putting all strings into one place as in your example might be a good practice, and as you know Sonntag doesn't restrict that way.

Unfortunately 'define-screen-command' doesn't take string name (but identifier).
Instead, you can write as following to use string:

Code:
{define-class FooScreen {inherits {Screen-of FooGraphic}}
  {constructor {default}
    {self.add-command
        {SimpleCommand
            "my-command", || string name
            execute-proc = {fn => |# do your command #|}
        }
    }
  }
}

This is not proposed way of Sonntag but another way that will work.


As to event bus messages, send-message takes 'any' value (not just only string) so
it is recommended you to use specific object as a message.
String messages in Umemura's example are probably for the sake of simple to describe how to use it.

Code:
|| declare message object
{define-class public ApplicationTerminatingMessage}

|| send message
{screen.send-message {ApplicationTerminatingMessage}}

|| handle message
  {method protected {handle-message
                        sender:#BroadcastEventTarget,
                        message:any
                    }:void
    {type-switch
     case msg:ApplicationTerminatingMessage do
        || handle here
    }
  }


Anyway, Sonntag's screen command stuff has much room for improvement so any suggestions are welcome.



Messages In This Thread
RE: Sonntag MVC without strings or name - by fukuta - 08-08-2011, 10:42 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Sonntag で別画面(Screen)のイベントを呼ぶ umemura 2 4,048 08-04-2011, 02:47 AM
Last Post: RobertShiplett
  Sonntag でCommand を呼び出す umemura 4 4,128 08-02-2011, 09:24 AM
Last Post: fukuta
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('187')