June 01, 2024, 09:37:39 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


SubClass TabControl

Started by LarryMc, September 04, 2008, 09:24:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

I want to subclass my tabcontrol.

I did this:
string LPFNPROP
LPFNPROP= "Z8TD96"

TabControl win_main,0,5,783,24,@TABSTOP|@TCS_TOOLTIPS|@TCS_HOTTRACK,0,TABCTL

_SetProp(getcontrolhandle(win_main,TABCTL), LPFNPROP, _SetWindowLong(getcontrolhandle(win_main,TABCTL), GWL_WNDPROC, &MyTabProc))

sub MyTabProc(int hwnd,UINT uMsg,int wParam,int lParam),int
int proc
proc = _GetProp(hwnd, LPFNPROP)
select uMsg
case WM_DESTROY
' remove subclass and delete window property
_SetWindowLong(hwnd, GWL_WNDPROC, proc)
_RemoveProp(hwnd, LPFNPROP)
case WM_PAINT
' do default, then redraw sizing tools
_CallWindowProc(proc, hwnd, WM_PAINT, 0, 0)
'do my paint here
return 0
endselect
return _CallWindowProc(proc, hwnd, uMsg,wParam,lParam)
endsub

The tabcontrol initially paints but is totally dead after that.
What'd I do wrong?

Larry

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

You do need to pass wparam and lparam in the WM_PAINT default call.  Otherwise the control won't have a DC to paint into.
Ionic Wind Support Team

Ionic Wind Support Team

So it should be:

return _CallWindowProc(proc, hwnd, WM_PAINT, wparam, lparam)
Ionic Wind Support Team

LarryMc

Changed to what you said; no improvement.
It is causing everything on the parent window client area not to update(not paint)

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Different approach:

Is there a way to subclass the menu bar in a window so that you can put static controls on it?

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library