| Newsgroups |
gmane.comp.lang.ocaml.beginners |
| Message-ID |
<[email protected]> |
Well, here's my take on some of those approaches:
OcamlJava and js_of_ocaml sound like really good options.
For one, using a browser is very modern. You can reach all os's and you don't really have to fanagle in terms of limitations that the route for drawing to the screen put on you. The js_of_ocaml sounds like a really good route, because all your software will be a service, and additionally, everything can be a callback. You'll need to learn a lot, but I think this is really the very best option.
Ocamljava does put some restrictions on you because you can't use any library that has C code as a dependency.
Going from OCaml to just native C is easy with ctypes. The other way around is a nightmare because OCaml has a runtime and virtual machine; you have to interface with that in order for things to work, and that means taking some significantly complicated considerations.
I really wouldn't worry so much about the minor version of a library as the big version unless you need something that's critical. The caml manual specific description of using labltk sounds acceptable, and you can bet that if it's in the manual that lots of people have taken that approach.
Printing pdfs from OCaml sounds slow as all getout, and pdfs are really bloated.
On Friday, June 26, 2015 2:59 PM, "Hendrik Boom [email protected] [ocaml_beginners]" <[email protected]> wrote:
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
>
>
#yiv7050799578 #yiv7050799578 -- #yiv7050799578ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv7050799578 #yiv7050799578ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv7050799578 #yiv7050799578ygrp-mkp #yiv7050799578hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv7050799578 #yiv7050799578ygrp-mkp #yiv7050799578ads {margin-bottom:10px;}#yiv7050799578 #yiv7050799578ygrp-mkp .yiv7050799578ad {padding:0 0;}#yiv7050799578 #yiv7050799578ygrp-mkp .yiv7050799578ad p {margin:0;}#yiv7050799578 #yiv7050799578ygrp-mkp .yiv7050799578ad a {color:#0000ff;text-decoration:none;}#yiv7050799578 #yiv7050799578ygrp-sponsor #yiv7050799578ygrp-lc {font-family:Arial;}#yiv7050799578 #yiv7050799578ygrp-sponsor #yiv7050799578ygrp-lc #yiv7050799578hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv7050799578 #yiv7050799578ygrp-sponsor #yiv7050799578ygrp-lc .yiv7050799578ad {margin-bottom:10px;padding:0 0;}#yiv7050799578 #yiv7050799578actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv7050799578 #yiv7050799578activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv7050799578 #yiv7050799578activity span {font-weight:700;}#yiv7050799578 #yiv7050799578activity span:first-child {text-transform:uppercase;}#yiv7050799578 #yiv7050799578activity span a {color:#5085b6;text-decoration:none;}#yiv7050799578 #yiv7050799578activity span span {color:#ff7900;}#yiv7050799578 #yiv7050799578activity span .yiv7050799578underline {text-decoration:underline;}#yiv7050799578 .yiv7050799578attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv7050799578 .yiv7050799578attach div a {text-decoration:none;}#yiv7050799578 .yiv7050799578attach img {border:none;padding-right:5px;}#yiv7050799578 .yiv7050799578attach label {display:block;margin-bottom:5px;}#yiv7050799578 .yiv7050799578attach label a {text-decoration:none;}#yiv7050799578 blockquote {margin:0 0 0 4px;}#yiv7050799578 .yiv7050799578bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv7050799578 .yiv7050799578bold a {text-decoration:none;}#yiv7050799578 dd.yiv7050799578last p a {font-family:Verdana;font-weight:700;}#yiv7050799578 dd.yiv7050799578last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv7050799578 dd.yiv7050799578last p span.yiv7050799578yshortcuts {margin-right:0;}#yiv7050799578 div.yiv7050799578attach-table div div a {text-decoration:none;}#yiv7050799578 div.yiv7050799578attach-table {width:400px;}#yiv7050799578 div.yiv7050799578file-title a, #yiv7050799578 div.yiv7050799578file-title a:active, #yiv7050799578 div.yiv7050799578file-title a:hover, #yiv7050799578 div.yiv7050799578file-title a:visited {text-decoration:none;}#yiv7050799578 div.yiv7050799578photo-title a, #yiv7050799578 div.yiv7050799578photo-title a:active, #yiv7050799578 div.yiv7050799578photo-title a:hover, #yiv7050799578 div.yiv7050799578photo-title a:visited {text-decoration:none;}#yiv7050799578 div#yiv7050799578ygrp-mlmsg #yiv7050799578ygrp-msg p a span.yiv7050799578yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv7050799578 .yiv7050799578green {color:#628c2a;}#yiv7050799578 .yiv7050799578MsoNormal {margin:0 0 0 0;}#yiv7050799578 o {font-size:0;}#yiv7050799578 #yiv7050799578photos div {float:left;width:72px;}#yiv7050799578 #yiv7050799578photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv7050799578 #yiv7050799578photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv7050799578 #yiv7050799578reco-category {font-size:77%;}#yiv7050799578 #yiv7050799578reco-desc {font-size:77%;}#yiv7050799578 .yiv7050799578replbq {margin:4px;}#yiv7050799578 #yiv7050799578ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv7050799578 #yiv7050799578ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv7050799578 #yiv7050799578ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv7050799578 #yiv7050799578ygrp-mlmsg select, #yiv7050799578 input, #yiv7050799578 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv7050799578 #yiv7050799578ygrp-mlmsg pre, #yiv7050799578 code {font:115% monospace;}#yiv7050799578 #yiv7050799578ygrp-mlmsg * {line-height:1.22em;}#yiv7050799578 #yiv7050799578ygrp-mlmsg #yiv7050799578logo {padding-bottom:10px;}#yiv7050799578 #yiv7050799578ygrp-msg p a {font-family:Verdana;}#yiv7050799578 #yiv7050799578ygrp-msg p#yiv7050799578attach-count span {color:#1E66AE;font-weight:700;}#yiv7050799578 #yiv7050799578ygrp-reco #yiv7050799578reco-head {color:#ff7900;font-weight:700;}#yiv7050799578 #yiv7050799578ygrp-reco {margin-bottom:20px;padding:0px;}#yiv7050799578 #yiv7050799578ygrp-sponsor #yiv7050799578ov li a {font-size:130%;text-decoration:none;}#yiv7050799578 #yiv7050799578ygrp-sponsor #yiv7050799578ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv7050799578 #yiv7050799578ygrp-sponsor #yiv7050799578ov ul {margin:0;padding:0 0 0 8px;}#yiv7050799578 #yiv7050799578ygrp-text {font-family:Georgia;}#yiv7050799578 #yiv7050799578ygrp-text p {margin:0 0 1em 0;}#yiv7050799578 #yiv7050799578ygrp-text tt {font-size:120%;}#yiv7050799578 #yiv7050799578ygrp-vital ul li:last-child {border-right:none !important;}#yiv7050799578