1

I am working on writing a GUI in Haskell (and Ur/Web, but that is another story), and have several development branches using different libraries and approaches that I am working on contemporaneously. In trying to migrate some of the code I had from browser-backed UI libraries with HTML elements (threepenny-gui, to be precise) to native GUI applets using a WX graphical backend (wxHaskell, reactive-banana), I encountered some trouble figuring out how to migrate some code I had that was based on constructing a <table> element to an equivalent wxWidgets construct. It seemed to me that there was no easy way to implement such a thing on my own, and no native equivalent. I am looking for implementation suggestions, pointers to extant implementations, suitable alternatives, and so forth. I can provide more in-depth specifics of the design I am looking for, should that be required.

The html table is merely used for aligning and displaying data, where one cell in every row is a reactive control, and the number of rows displayed at any given time can also vary reactively.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
archaephyrryx
  • 415
  • 2
  • 10

1 Answers1

2

HTML table can contain just about anything in its cells so it's too rich to be represented by any native control. It's really hard to make a recommendation without knowing what exactly you have in the table, but the different possibilities are:

  • wxHtmlWindow: this can be used to reuse your HTML provided it's simple enough (HTML4 basically) and you can embed native controls into it if needed.
  • wxGrid: this is the most flexible widget, but it's not native.
  • wxDataViewCtrl: this is native control under GTK and OS X (but not MSW where you'd need to use wxListCtrl for 100% native approach) but it's pretty limited compared to either of the above solutions.
VZ.
  • 21,740
  • 3
  • 39
  • 42
  • In my widget library building, I am trying to keep things as general as possible, but the particular application I have in mind would contain only text and small icons, in addition to the reactive widget I mentioned. That widget is in turn an elevated button that snapshots a time-varying value at click-time. – archaephyrryx Jan 16 '16 at 21:34
  • This looks doable with wxDVC but you'd have to write a custom renderer for the widget. – VZ. Jan 16 '16 at 23:44
  • I am used to writing custom renderers for my widgets. Do you have any examples/guides that might help me implement the DVC table? I don't have a lot of familiarity with the library. – archaephyrryx Jan 17 '16 at 00:36
  • As usual, look at the [sample](https://github.com/wxWidgets/wxWidgets/blob/WX_3_0_2/samples/dataview/dataview.cpp) – VZ. Jan 17 '16 at 01:29
  • this is interesting, but not especially useful to me as it stands (I may be missing something though), as wxHaskell doesn't seem to implement this. I will probably try to go about writing a custom widget for this purpose. – archaephyrryx Jan 18 '16 at 00:44