Re: User interface libraries

"Hendrik Boom [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
On Fri, Jun 26, 2015 at 05:24:17AM +0000, Kenneth Miller [email protected] [ocaml_beginners] wrote:
> The below is a good answer, but you might consider interfacing ocaml to another language by some means, either RPC or function bindings. Depending on your software that you're writing, you might be able to just compile your ocaml code down to java with ocamljava compilers, write you java gui, and then have ocaml's type safety and richness help you. But you can't compile any ocaml code that calls into C functions from the JVM because I (or someone else if they beat me) haven't written the ctypes backend for JVM yet :)
> OCaml: Effective Path to GUI Programming?

OK.  What I've found so far.

The stackoverflow article you supplied me with:

http://stackoverflow.com/questions/15651539/ocaml-effective-path-to-gui-programming

It links to various places, including:

chapter 28 of an OCaml manual, describing an interface wth tcl/tk:
http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual042.html

OCaml-java:
http://www.ocamljava.org/

A code example on calling OCaml code from C:
http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/calling_ocaml.html

lablgtk,an OCaml binding for GTK:
https://forge.ocamlcore.org/projects/lablgtk/
I quote:
: It comes in two flavors: LablGTK1 for gtk+-1.2
: and LablGTK2 for gtk+-2.0 to gtk+-2.16.
But gtk2 seems to already be at version 2.24 on Debian stable,
and Debian stable isn't exatly all that up-to-date itself.
I wonder how compatible it still is.  Or is this announcement out-of-date?
And, of course, the world seems to in transition from GTK2 to GTK3.
Does GTK3 handle UTF-8?  I don't much care it OCaml does anything special
for UTF-8, because the whole point of UTF-8 is that you can treat
it as a stream of 8-byte characters ost of the time
except when you get to the point of displaying it, 
which of course is where the UI library should step in.

There's OCaml-Java, in case I want to do the whole UI stuff in Java.
http://www.ocamljava.org/

And js_of_ocaml, in case I want interpreted javascript in a browser.
http://ocsigen.org/js_of_ocaml/

And chapter 19 0f an OCaml manual:
http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html
This describes how to interface C with OCaml.

I've once used Cairo to print diagrams from OCaml,
telling it to make a pdf as its output channel.
Since gtk will provide a window for Cairo to display in,
Cairo could suffice for my text display (It may even be overkill).
Don't know if the Cairo canvas requires GTK3, though.

The interation between the UI and the data structures
I plan to use in OCaml are rather comples and intimate, so farming the
whole application user-interface code to C is a nonstarter.

Still undecided.  Will investigate further.

-- hendrik



> 
> |   |
> |   |  |   |   |   |   |   |
> | OCaml: Effective Path to GUI Programming?I have seen a few threads that touch on GUI programming in OCaml but I don't feel they clearly lead to a clear-cut solution when a GUI interface is needed. My quest... |
> |  |
> | View on stackoverflow.com | Preview by Yahoo |
> |  |
> |   |
> 
>  
> 
> 
> 
>      On Friday, June 26, 2015 12:38 AM, "Hendrik Boom [email protected] [ocaml_beginners]" <[email protected]> wrote:
>    
> 
>      What user-interface libraries and/or bindings are available in/for OCAML?
> 
> Do any of them handle UTF-8?
> 
> Which are cross-platform? My primary platform is Linux on 32-bit intel 
> architecture, but portability to others would be covenient.
> 
> What I need at the moment is a paned window (or several windows), a few 
> menus, mouse movements, button annd key clicks, and the ability to 
> place and erase pieces of text pretty well anywhere in those panes, 
> preferably in several colours and a few type faces (plain, italic, 
> bold).
> 
> -- hendrik
>   #yiv9566384967 #yiv9566384967 -- #yiv9566384967ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv9566384967 #yiv9566384967ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv9566384967 #yiv9566384967ygrp-mkp #yiv9566384967hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv9566384967 #yiv9566384967ygrp-mkp #yiv9566384967ads {margin-bottom:10px;}#yiv9566384967 #yiv9566384967ygrp-mkp .yiv9566384967ad {padding:0 0;}#yiv9566384967 #yiv9566384967ygrp-mkp .yiv9566384967ad p {margin:0;}#yiv9566384967 #yiv9566384967ygrp-mkp .yiv9566384967ad a {color:#0000ff;text-decoration:none;}#yiv9566384967 #yiv9566384967ygrp-sponsor #yiv9566384967ygrp-lc {font-family:Arial;}#yiv9566384967 #yiv9566384967ygrp-sponsor #yiv9566384967ygrp-lc #yiv9566384967hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv9566384967 #yiv9566384967ygrp-sponsor #yiv9566384967ygrp-lc .yiv9566384967ad {margin-bottom:10px;padding:0 0;}#yiv9566384967 #yiv9566384967actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv9566384967 #yiv9566384967activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv9566384967 #yiv9566384967activity span {font-weight:700;}#yiv9566384967 #yiv9566384967activity span:first-child {text-transform:uppercase;}#yiv9566384967 #yiv9566384967activity span a {color:#5085b6;text-decoration:none;}#yiv9566384967 #yiv9566384967activity span span {color:#ff7900;}#yiv9566384967 #yiv9566384967activity span .yiv9566384967underline {text-decoration:underline;}#yiv9566384967 .yiv9566384967attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv9566384967 .yiv9566384967attach div a {text-decoration:none;}#yiv9566384967 .yiv9566384967attach img {border:none;padding-right:5px;}#yiv9566384967 .yiv9566384967attach label {display:block;margin-bottom:5px;}#yiv9566384967 .yiv9566384967attach label a {text-decoration:none;}#yiv9566384967 blockquote {margin:0 0 0 4px;}#yiv9566384967 .yiv9566384967bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv9566384967 .yiv9566384967bold a {text-decoration:none;}#yiv9566384967 dd.yiv9566384967last p a {font-family:Verdana;font-weight:700;}#yiv9566384967 dd.yiv9566384967last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv9566384967 dd.yiv9566384967last p span.yiv9566384967yshortcuts {margin-right:0;}#yiv9566384967 div.yiv9566384967attach-table div div a {text-decoration:none;}#yiv9566384967 div.yiv9566384967attach-table {width:400px;}#yiv9566384967 div.yiv9566384967file-title a, #yiv9566384967 div.yiv9566384967file-title a:active, #yiv9566384967 div.yiv9566384967file-title a:hover, #yiv9566384967 div.yiv9566384967file-title a:visited {text-decoration:none;}#yiv9566384967 div.yiv9566384967photo-title a, #yiv9566384967 div.yiv9566384967photo-title a:active, #yiv9566384967 div.yiv9566384967photo-title a:hover, #yiv9566384967 div.yiv9566384967photo-title a:visited {text-decoration:none;}#yiv9566384967 div#yiv9566384967ygrp-mlmsg #yiv9566384967ygrp-msg p a span.yiv9566384967yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv9566384967 .yiv9566384967green {color:#628c2a;}#yiv9566384967 .yiv9566384967MsoNormal {margin:0 0 0 0;}#yiv9566384967 o {font-size:0;}#yiv9566384967 #yiv9566384967photos div {float:left;width:72px;}#yiv9566384967 #yiv9566384967photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv9566384967 #yiv9566384967photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv9566384967 #yiv9566384967reco-category {font-size:77%;}#yiv9566384967 #yiv9566384967reco-desc {font-size:77%;}#yiv9566384967 .yiv9566384967replbq {margin:4px;}#yiv9566384967 #yiv9566384967ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv9566384967 #yiv9566384967ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv9566384967 #yiv9566384967ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv9566384967 #yiv9566384967ygrp-mlmsg select, #yiv9566384967 input, #yiv9566384967 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv9566384967 #yiv9566384967ygrp-mlmsg pre, #yiv9566384967 code {font:115% monospace;}#yiv9566384967 #yiv9566384967ygrp-mlmsg * {line-height:1.22em;}#yiv9566384967 #yiv9566384967ygrp-mlmsg #yiv9566384967logo {padding-bottom:10px;}#yiv9566384967 #yiv9566384967ygrp-msg p a {font-family:Verdana;}#yiv9566384967 #yiv9566384967ygrp-msg p#yiv9566384967attach-count span {color:#1E66AE;font-weight:700;}#yiv9566384967 #yiv9566384967ygrp-reco #yiv9566384967reco-head {color:#ff7900;font-weight:700;}#yiv9566384967 #yiv9566384967ygrp-reco {margin-bottom:20px;padding:0px;}#yiv9566384967 #yiv9566384967ygrp-sponsor #yiv9566384967ov li a {font-size:130%;text-decoration:none;}#yiv9566384967 #yiv9566384967ygrp-sponsor #yiv9566384967ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv9566384967 #yiv9566384967ygrp-sponsor #yiv9566384967ov ul {margin:0;padding:0 0 0 8px;}#yiv9566384967 #yiv9566384967ygrp-text {font-family:Georgia;}#yiv9566384967 #yiv9566384967ygrp-text p {margin:0 0 1em 0;}#yiv9566384967 #yiv9566384967ygrp-text tt {font-size:120%;}#yiv9566384967 #yiv9566384967ygrp-vital ul li:last-child {border-right:none !important;}#yiv9566384967 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.