QuickDialogs?
I'm wondering if and how one could possibly implement the idea of QuickDialogs in Jabaco.
Any ideas? Any volunteers?
Greetings
A1880
Any ideas? Any volunteers?
Greetings
A1880
Hi 1880,
cool thing. It makes use of operator overloading, which is neither possible in Jabaco nor is it possible in Java.
I read, it uses some Boost stuff (Boost::Format, Boost:spirit) which does also not exist in the java world.
How would you handle this, please make a suggestion.
regards
OlimilO
cool thing. It makes use of operator overloading, which is neither possible in Jabaco nor is it possible in Java.
|
|
Source code |
1 |
d << ~*(button("&Chicken", qdYes) | button("&Egg", qdNo) | button("&Don't Care", qdCancel))
|
I read, it uses some Boost stuff (Boost::Format, Boost:spirit) which does also not exist in the java world.
How would you handle this, please make a suggestion.
regards
OlimilO
Of course, C++ has more syntactic tricks to provide than Java and Jabaco.
The implementation of QuickDialogs is hardly readable.
I am fascinated by the idea to compose dialogs with a few lines of code rather than using a graphical IDE.
The syntax is not really important. Therefore, operator overloading should not be required.
A list of parameterized dialog components can simply be put together by calling dialog methods in a certain order.
The second example of the original QuickDialogs article could be jabacoized as follows:
The spirit of QuickDialogs is hidden in its "LayoutEngine" which arranges the previously defined dialog components.
A have no clear picture yet, how QuickDialogs could be implemented in Java or Jabaco.
In terms of patterns, it would be a sort of factory class. The factory creates a dialog object and provides
methods to influence the creation process. To make the whole thing easy to use, a high degree of abstraction and standardization
is needed. Unless the visual properties of dialogs are highly standardized, it is not possible to specify a dialog
without dozens of parameters. Re-occuring things like fonts, colors, button widths/heights/distances etc. have to be
defined once. The dialog layout has to follow rather strict rules. That should be a plus, because dialogs have to follow
some sort of common style guide anyhow to give a decent overall impression.
Greetings
A1880
The implementation of QuickDialogs is hardly readable.
I am fascinated by the idea to compose dialogs with a few lines of code rather than using a graphical IDE.
The syntax is not really important. Therefore, operator overloading should not be required.
A list of parameterized dialog components can simply be put together by calling dialog methods in a certain order.
The second example of the original QuickDialogs article could be jabacoized as follows:
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Dim d as new QDialog d.title("My second dialog") d.image(myIconResource) d.columnbreak() d.spacer(20) d.message("Which came first, the chicken or the egg?") d.sectionbreak() d.spacer() d.buttons(d.button("&Chicken", qdYes), d.button("&Egg", qdNo), d.button("&Don't Care", qdCancel)) d.spacer() d.checkBox("Don't ask again", check) ' not quite sure about the purpose of the "check" variable if d.show() = qdYes then ' ..... end if |
The spirit of QuickDialogs is hidden in its "LayoutEngine" which arranges the previously defined dialog components.
A have no clear picture yet, how QuickDialogs could be implemented in Java or Jabaco.
In terms of patterns, it would be a sort of factory class. The factory creates a dialog object and provides
methods to influence the creation process. To make the whole thing easy to use, a high degree of abstraction and standardization
is needed. Unless the visual properties of dialogs are highly standardized, it is not possible to specify a dialog
without dozens of parameters. Re-occuring things like fonts, colors, button widths/heights/distances etc. have to be
defined once. The dialog layout has to follow rather strict rules. That should be a plus, because dialogs have to follow
some sort of common style guide anyhow to give a decent overall impression.
Greetings
A1880
This post has been edited 1 times, last edit by "A1880" (May 15th 2011, 10:07am)
You are right. The (nearly) only problem is the layout. It needs the use of different layoutmanager.
I have create at the moment a quick and dirty skeleton of that code, without different laqoutmanager.
This
creates this window:

When you resize the window by hand, it looks nearly like that of the codeproject side:

Greatings
theuserbl
I have create at the moment a quick and dirty skeleton of that code, without different laqoutmanager.
This
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
public class Simple { public static void main(String[] args) { QDialog d = new QDialog(); d.title("My second dialog"); d.image("ChickenEgg.png"); d.message("Which came first, the chicken or the egg?"); d.buttons(d.button("&Chicken"), d.button("&Egg"), d.button("&Don't Care")); d.checkBox("Don't ask again"); d.shows(); } } |
creates this window:
When you resize the window by hand, it looks nearly like that of the codeproject side:
Greatings
theuserbl
