#1237 A question about FWT design

DanielFath Tue 28 Sep 2010

I have a couple of questions regarding fwt

  1. How come Label, Text, Button don't subclass fwt::Canvas?
  2. Is there any way to add a tooltip/hint to a Widget?

andy Tue 28 Sep 2010

1. How come Label, Text, Button don't subclass fwt::Canvas?

These controls are native to the platform, so dependent on how the underlying platform implements them.

2. Is there any way to add a tooltip/hint to a Widget?

Not at the moment.

DanielFath Wed 29 Sep 2010

Ok, but when dealing with widgets isn't the standard practice to have two sublclasses (Containter - contains widgets and Component - represents a single widget) in accordance to Composite design pattern?

andy Wed 29 Sep 2010

We do: fwt::Pane.

go4 Thu 30 Sep 2010

I intend to draw out all widget with graphics context.

DanielFath Sat 9 Oct 2010

Thanks for all your help andy. I do, however have few more questions:

  • Is there a way to get horizontal/vertical DPI (in SWT terms it is Dispay.getDPI.x/ .y (for horizontal and vertical DPI respectively) )?
  • Is fwt always Left-to-Right?
  • Is there a way to get monitor on which the widget is displayed? If no is it safe to assume that it will be the primary monitor?

brian Sat 9 Oct 2010

Is there a way to get horizontal/vertical DPI (in SWT terms it is Dispay.getDPI.x/ .y (for horizontal and vertical DPI respectively) )?

Not today, although should be easy to expose it if it is on Display, although also need to figure out how to do it in JS first

Is fwt always Left-to-Right?

It is whatever SWT does by default in JVM, in browser yes

Is there a way to get monitor on which the widget is displayed? If no is it safe to assume that it will be the primary monitor?

I think you should be able to derive that from your widget bounds on the screen, then Monitor bounds?

DanielFath Sun 10 Oct 2010

I think you should be able to derive that from your widget bounds on the screen, then Monitor bounds?

Something like this?

//Comp reffers to widget
if(comp.posOnDisplay != null)
{
  Monitor.list.each |Monitor m|
  {
    if (m.screenBounds.contains(comp.posOnDisplay.x,comp.posOnDisplay.y))
    return m
  }

}
return Monitor.primary

EDIT: This ain't actual code, more like a prototype.

brian Mon 11 Oct 2010

I pushed a fix to add Monitor.dpi, changeset

It looks like SWT only supports DPI for the entire display, not on per a monitor basis. I don't know if current OS support that, but seems like it should be a per monitor thing.

qualidafial Wed 13 Oct 2010

It looks like SWT only supports DPI for the entire display, not on per a monitor basis. I don't know if current OS support that, but seems like it should be a per monitor thing.

I would disagree with this. As an app developer I have no idea what I would be expected to do when the application window overlaps across two monitors with different DPIs.

For what it's worth, on Ubuntu Linux I have only one DPI setting for all monitors.

Login or Signup to reply.