|
|
Re: DateTime Dialog [message #1713413 is a reply to message #1713256] |
Tue, 03 November 2015 21:21 |
|
On 02/11/2015 20:54, John Conlon wrote:
> I have partially met the requirement with a DateTime widget. Which
> gives users the ability to choose dates.
> Package : expire -> {
> createDateTime(
> SWT::BORDER
> )
> }target observeSelection()
>
> So how can I add date and time controls for an attribute in a form? (Or
> add a dialog like I previously asked?)
>
> thanks,
> John
Hi John
if I understand correctly, for a given feature you want to create both a
text (or a date control, which you've already managed to do) and a
button (e.g., beside that).
If that is the case, remember that in the DSL you can use Java
libraries, in particular, standard SWT API (plus, the nice syntax of
Xbase which reduces syntactic noise and provides lambdas).
Here's an example using the Library model for the Book:title:
formControlFactory {
control {
Book : title -> {
val c = new Composite(parent, SWT.NONE)
c.layout = new GridLayout(2, false)
val t = createText(c, SWT.BORDER)
val b = new Button(c, SWT.PUSH)
b.^text = "Push me"
b.addListener(SWT.MouseDown) [
MessageDialog.openInformation(c.shell, "Event", "You pushed me!")
]
return t
} target { observeText }
}
}
it puts a text and a button in a composite side by side and a listener
on the button showing the information dialog (as I said, it uses Xbase's
syntax for lambdas). Note that the databinding is setup for the text
control (not for the composite container)
Does that help?
cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
|
Powered by
FUDForum. Page generated in 0.03028 seconds