You are not logged in.

A1880

Intermediate

  • "A1880" is male
  • "A1880" started this thread

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

1

Tuesday, May 10th 2011, 5:53pm

QuickDialogs?

I'm wondering if and how one could possibly implement the idea of QuickDialogs in Jabaco.

Any ideas? Any volunteers?

Greetings

A1880

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

2

Saturday, May 14th 2011, 6:28pm

Hi 1880,
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

A1880

Intermediate

  • "A1880" is male
  • "A1880" started this thread

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

3

Sunday, May 15th 2011, 1:32am

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:

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)


theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

4

Sunday, May 15th 2011, 3:53pm

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

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
theuserbl has attached the following file:
  • QuickDialog1.zip (8.9 kB - 264 times downloaded - latest: Oct 8th 2019, 11:47am)

Rate this thread
WoltLab Burning Board