coloured LISTVIEW elements using subclassing - doesn`t work when using tabctl32.ocx 
Author Message
 coloured LISTVIEW elements using subclassing - doesn`t work when using tabctl32.ocx

hi

my application uses a listview. i wanted a predefined list element to appear
in bold red when the list was displayed.

in order to do this i started looking at subclassing - i found the following
example.

http://www.*-*-*.com/

this is written by "Bryan Stafford of New Vision Software?"

anyway - the example he provides works pretty well - i don`t fully
understand the intrices of subclassing .. but i`ve modified the code to suit
my purposes.

however if i  add an SSTAB control to the example codes form .. which
consists of 3 tabs .. and then move the listview "lvCustomDraw" onto the
second tab.

running the code - the listview elements are no longer changed ...

i suspected that the wrong handle was being passed to the subclassing ....

g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)

i tried  lvCustomDraw.hWnd - but this made no difference.

Can anyone explain to me what i`m doing wrong , what needs to be done..

many thanks in advance

DAVE



Thu, 09 Dec 2004 00:49:50 GMT  
 coloured LISTVIEW elements using subclassing - doesn`t work when using tabctl32.ocx
Bryan should see this message if you post it to the msnews.microsoft.com's
public.winapi forum.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


Quote:
> hi

> my application uses a listview. i wanted a predefined list element to
appear
> in bold red when the list was displayed.

> in order to do this i started looking at subclassing - i found the
following
> example.

> http://www.mvps.org/vbvision/_samples/CustomDrawLV_Demo.zip

> this is written by "Bryan Stafford of New Vision Software?"

> anyway - the example he provides works pretty well - i don`t fully
> understand the intrices of subclassing .. but i`ve modified the code to
suit
> my purposes.

> however if i  add an SSTAB control to the example codes form .. which
> consists of 3 tabs .. and then move the listview "lvCustomDraw" onto the
> second tab.

> running the code - the listview elements are no longer changed ...

> i suspected that the wrong handle was being passed to the subclassing ....

> g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)

> i tried  lvCustomDraw.hWnd - but this made no difference.

> Can anyone explain to me what i`m doing wrong , what needs to be done..

> many thanks in advance

> DAVE



Thu, 09 Dec 2004 01:04:46 GMT  
 coloured LISTVIEW elements using subclassing - doesn`t work when using tabctl32.ocx
Is there any subclassing of the form?  Doing certain things (e.g. handling
notification codes in WM_COMMAND) requires subclassing the parent of the
control.  If the example you modified subclasses the form instead of
properly finding the parent window of the control, that may be the problem.
If you put the control in a container (SSTab, frames, picture boxes, etc),
the parent is no longer the form.  If all that's being subclassed is the
ListView, I'm not really sure what could be going wrong.  If I dug into the
code I might be able to figure it out, but I have no time to do that this
weekend.  Sorry...


Quote:
> however if i  add an SSTAB control to the example codes form .. which
> consists of 3 tabs .. and then move the listview "lvCustomDraw" onto the
> second tab.



Thu, 09 Dec 2004 01:06:22 GMT  
 coloured LISTVIEW elements using subclassing - doesn`t work when using tabctl32.ocx


Wed, 18 Jun 1902 08:00:00 GMT  
 coloured LISTVIEW elements using subclassing - doesn`t work when using tabctl32.ocx
In Form_Load, change:
g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
to:
g_addProcOld = SetWindowLong(SSTab1.hWnd, GWL_WNDPROC, AddressOf WindowProc)

and.... in Form_Unload, change:
Call SetWindowLong(hWnd, GWL_WNDPROC, g_addProcOld)
to:
Call SetWindowLong(SSTab1.hWnd, GWL_WNDPROC, g_addProcOld)


Quote:
> hi

> my application uses a listview. i wanted a predefined list element to
appear
> in bold red when the list was displayed.

> in order to do this i started looking at subclassing - i found the
following
> example.

> http://www.mvps.org/vbvision/_samples/CustomDrawLV_Demo.zip

> this is written by "Bryan Stafford of New Vision Software?"

> anyway - the example he provides works pretty well - i don`t fully
> understand the intrices of subclassing .. but i`ve modified the code to
suit
> my purposes.

> however if i  add an SSTAB control to the example codes form .. which
> consists of 3 tabs .. and then move the listview "lvCustomDraw" onto the
> second tab.

> running the code - the listview elements are no longer changed ...

> i suspected that the wrong handle was being passed to the subclassing ....

> g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)

> i tried  lvCustomDraw.hWnd - but this made no difference.

> Can anyone explain to me what i`m doing wrong , what needs to be done..

> many thanks in advance

> DAVE



Thu, 09 Dec 2004 04:36:10 GMT  
 coloured LISTVIEW elements using subclassing - doesn`t work when using tabctl32.ocx
This is exactly what I was talking about...


Quote:
> In Form_Load, change:
> g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
> to:
> g_addProcOld = SetWindowLong(SSTab1.hWnd, GWL_WNDPROC, AddressOf
WindowProc)

> and.... in Form_Unload, change:
> Call SetWindowLong(hWnd, GWL_WNDPROC, g_addProcOld)
> to:
> Call SetWindowLong(SSTab1.hWnd, GWL_WNDPROC, g_addProcOld)



Sun, 12 Dec 2004 21:56:13 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Multi-Coloured ListBox elements ?

2. VB doesn`t work with outline-control..

3. Coloured cells in standard ListView?

4. Tabctl32.ocx dependency file (Tabctl32.deb)

5. looking for an enum example that uses attrlist in its elements

6. Array is using upper bound as valid element?!?

7. Detecting the movement of a form, using subclassing.

8. Getting DHTML Element Events using InternetExplorer Object

9. How to end a program that used subclassing

10. Using 'regular' events vs subclassing

11. Using subclassing

12. Filtering Using Subclassing

 

 
Powered by phpBB® Forum Software