programming gui questions

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Uri Blass
Posts: 8586
Joined: Wed Mar 08, 2006 11:37 pm
Location: Tel-Aviv Israel

programming gui questions

Post by Uri Blass » Tue May 20, 2008 2:55 pm

1)What is the best language to write gui?
2)What is the smallest free source code that is about gui that people can learn from it about chess gui(not that it does not have to be gui for chess and it can be gui for another game when it is possible to write gui for chess by similiar ideas)
3)replace smallest with simplest
Is the answer still the same?
Note that not always smaller is simpler so maybe the answer is negative.

Uri

Pradu
Posts: 287
Joined: Sat Mar 11, 2006 2:19 am
Location: Atlanta, GA
Contact:

Re: programming gui questions

Post by Pradu » Tue May 20, 2008 4:43 pm

Uri Blass wrote:1)What is the best language to write gui?
Personally, I think it'd be C++ with wxWidgets.

Guetti

Re: programming gui questions

Post by Guetti » Tue May 20, 2008 4:46 pm

or Java.

Gerd Isenberg
Posts: 2127
Joined: Wed Mar 08, 2006 7:47 pm
Location: Hattingen, Germany

Re: programming gui questions

Post by Gerd Isenberg » Tue May 20, 2008 5:05 pm

Guetti wrote:or Java.
or TCL/TK?

Gerd Isenberg
Posts: 2127
Joined: Wed Mar 08, 2006 7:47 pm
Location: Hattingen, Germany

Re: programming gui questions

Post by Gerd Isenberg » Tue May 20, 2008 5:13 pm

Uri Blass wrote:1)What is the best language to write gui?
Uri
Probably the language where you are most familar with - but gui-programming is quite different to standard console applications, message or callback oriented...

Some alternatives:

For windows one may use:
  • C and native windows (WinMain, RegisterWindowClass etc.) (arggg)
    C++ and MFC (argg)
    Borland Delphi
    Visual Basic
More portable: Gerd

User avatar
Steve Maughan
Posts: 1061
Joined: Wed Mar 08, 2006 7:28 pm
Location: Florida, USA
Contact:

Re: programming gui questions

Post by Steve Maughan » Tue May 20, 2008 7:34 pm

I'd highly recommend Delphi. IMO it's by far the easiest and most powerful language for writing GUIs. It's OK for chess engines and may be 30% slower than highly optimized 'C' but it's still OK. That 30% penalty is irrelevant when it comes to GUIs. That's why so many high quality applications are written in Delphi (Arena, Skype and Feedemon come to mind. See also:

http://en.wikipedia.org/wiki/Borland_Delphi

You can download a free version here:

www.turboexplorer.com

Steve

Dann Corbit
Posts: 10112
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: programming gui questions

Post by Dann Corbit » Tue May 20, 2008 8:11 pm

Uri Blass wrote:1)What is the best language to write gui?
2)What is the smallest free source code that is about gui that people can learn from it about chess gui(not that it does not have to be gui for chess and it can be gui for another game when it is possible to write gui for chess by similiar ideas)
3)replace smallest with simplest
Is the answer still the same?
Note that not always smaller is simpler so maybe the answer is negative.

Uri
Some examples with source code that you can peruse for yourself:
SCID is written with TCL/TK and C.
Jose is written with Java
Winboard uses Windows API calls (the Xboard version uses X-Windows)

I think that the easiest way would be to use either .net languages like Vb.NET or C# or to use Java.

Java has an advantage in that it will also work on Unix and .NET languages would require MONO and still be painful if you use any custom controls.

User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 2:27 pm

Re: programming gui questions

Post by Don » Wed May 21, 2008 3:59 am

Gerd Isenberg wrote:
Guetti wrote:or Java.
or TCL/TK?
tcl is substantially under rated. I would vote for tcl/tk for a good GUI. It's also an excellent cross-platform choice.

User avatar
Zach Wegner
Posts: 1922
Joined: Wed Mar 08, 2006 11:51 pm
Location: Earth
Contact:

Re: programming gui questions

Post by Zach Wegner » Wed May 21, 2008 4:19 am

To Don:

Your CGOS viewer is quite nice in TCL. I was pleasantly surprised when I used it, it seemed much more nice looking and responsive than a Java app.

To Uri:

I do think Java is very easy to use though. I wrote a full integrated GUI+chess engine in Java for a high school project in a few months. If I can find the source I can send you a copy. Of course the GUI is is incredibly simple, and doesn't use any protocols or anything. I can't imagine the whole thing was more than 1000 lines...

Tony

Re: programming gui questions

Post by Tony » Wed May 21, 2008 11:22 am

My old interface was in Delphi, which was pretty good.

Currently, I'm rewriting it in C#, which seems to be even better.

I specially like the usercontrols, ie a more "on the fly" form of Delphi components.

What is more important, is to design the message flow.

I have all the controls (boardControl, gameNotation,EngineOutputParser) raise events (but not respond) on the input, wich are all caught by the mainform, who reacts by sending messages to the controls to respond to (update board, gameNotation etc)

So if you click on the board, the board raises an event (move"e2e4"clicked), the mainform checks if the move is OK, and sends to the board: Move"e2e4";update board, and to the gameNotation: Move"e2e4";update notation.

It's very easy to mess up if you're not experienced with the language. Especially if you have to wait (ie block the thread) for a certain event.

It happend quite a few times I was waiting for an event, wich I accidently blocked as well.
The point is that some things have to happen synchrone and some asynchrone. This doesn't combine nicely with a multithreaded interface.

The visual part is easier, if you happen to like making that kind of stuff.

Tony

Post Reply