DUIM question 
Author Message
 DUIM question

I wanted to have a <table-control> where clicking on a row in the
table caused the whole row to be highlighted rather than the first
column. I also wanted to be able to click anywhere on the row to
select that row, rather than having to click the first column. I
couldn't find a way to do this using any options or keywords to the
<table-control>. Is there a standard way of doing this?

I've been able to get this behaviour using Win32 by calling the
following method on an instance of <table-control> that is already
displayed in a frame:

define constant $LVS-EX-FULLROWSELECT = #x20;
define constant $LVM-FIRST = #x1000;
define constant $LVM-GETEXTENDEDLISTVIEWSTYLE = $LVM-FIRST + #x37;
define constant $LVM-SETEXTENDEDLISTVIEWSTYLE = $LVM-FIRST + #x36;

define method set-extended-selection-style( tc :: <table-control> )
  let hwnd = tc.window-handle;
  let style = SendMessage(hwnd, $LVM-GETEXTENDEDLISTVIEWSTYLE, 0, 0);
  style := %logior(style, $LVS-EX-FULLROWSELECT);
  SendMessage(hwnd, $LVM-SETEXTENDEDLISTVIEWSTYLE, 0, lstyle);
end method set-extended-selection-style;

Note that I had to have the following libraries and modules imported
to compile the above:

define library a-library
  // ...
  use c-ffi;
  use win32-duim;
  use win32-user;
  // ...
end library a-library;

define module a-module
  // ...
  use c-ffi;
  use win32-duim, import: { window-handle };
  use win32-user, import: { SendMessage };
  // ...
end library a-module;

This works fine but I'd like to create a gadget that works exactly
like <table-control> but calls the set-extended-selection-style as
soon as the gadget is displayed (or whenever the 'window-handle'
becomes valid). Is there a method or event I can monitor to do this?
If not, is there some other way I can have this happen automatically?

I can't derive from the <win32-table-control> as it's sealed and
deriving from <table-control> doesn't seen to help because I still
need to override 'class-for-make-pane' to provide the class name for
the concrete class - and it's overriding the behavior of that concrete
class that I want to do (I think).

Is there something like a <gadget-created-event> or
<gadget-mapped-event> wandering around somewhere?

Chris.



Tue, 02 Oct 2001 03:00:00 GMT  
 DUIM question

Quote:
> I wanted to have a <table-control> where clicking on a row in the
> table caused the whole row to be highlighted rather than the first
> column. I also wanted to be able to click anywhere on the row to
> select that row, rather than having to click the first column. I
> couldn't find a way to do this using any options or keywords to the
> <table-control>. Is there a standard way of doing this?

I've wanted this too, I think we should just add it to DUIM. But in
the meantime...

Quote:
> This works fine but I'd like to create a gadget that works exactly
> like <table-control> but calls the set-extended-selection-style as
> soon as the gadget is displayed (or whenever the 'window-handle'
> becomes valid). Is there a method or event I can monitor to do this?
> If not, is there some other way I can have this happen
> automatically?

> I can't derive from the <win32-table-control> as it's sealed and
> deriving from <table-control> doesn't seen to help because I still
> need to override 'class-for-make-pane' to provide the class name for
> the concrete class - and it's overriding the behavior of that
> concrete class that I want to do (I think).

Right, subclassing the abstract gadget gives you no behavior, just the
protocols. So you'd want to subclass <win32-table-control>, but that's
sealed as you point out.

One option would be to create a wrapper class, something like:

  define pane <win32-extended-table-control> (<table-control>)
    pane %table (pane)
      make(<table-control>, ...);
    layout (pane)
      pane.%table;
  end pane <win32-extended-table-control>;

but then you'd need to implement all of the table contol protocols on
<win32-extended-table-control> which just dispatch on to the
subcontrol. I'm not sure how nicely that would turn out.

Quote:
> Is there something like a <gadget-created-event> or
> <gadget-mapped-event> wandering around somewhere?

Unfortunately no, I've needed that in the past and found this area of
DUIM to be lacking. We'd need to be careful not to have so many events
that the speed suffered, but I'd like to consider doing something like
this.

I think you're probably stuck with putting this functionality into the
frame, if you need to use the same gadget over and over you could
create a frame superclass that registers all of its table controls as
they are created, and then updates them all on receipt of a
<frame-created-event>.

Sorry not to be of more help, I'll keep thinking about your problem
and see if I can come up with something better.

Cheers,

Andy

----------

Harlequin Inc.



Tue, 02 Oct 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. DUIM question

2. DUIM focus question

3. A duim menu question

4. DUIM font question

5. Stupid question about DUIM/widgets

6. problem with DUIM at higher resolutions

7. updating an icon label in DUIM

8. updating an icon label in DUIM

9. help with DUIM application

10. DUIM clipboard

11. <tree-node> in DUIM

12. Browser gadget sugguestions for a DUIM app

 

 
Powered by phpBB® Forum Software