IonicWind Software

IWBasic => GUI Central => Topic started by: LarryMc on September 04, 2008, 09:24:29 PM

Title: SubClass TabControl
Post by: LarryMc on September 04, 2008, 09:24:29 PM
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

Title: Re: SubClass TabControl
Post by: Ionic Wind Support Team on September 04, 2008, 09:28:37 PM
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.
Title: Re: SubClass TabControl
Post by: Ionic Wind Support Team on September 04, 2008, 09:29:28 PM
So it should be:

return _CallWindowProc(proc, hwnd, WM_PAINT, wparam, lparam)
Title: Re: SubClass TabControl
Post by: LarryMc on September 04, 2008, 09:48:01 PM
Changed to what you said; no improvement.
It is causing everything on the parent window client area not to update(not paint)

Larry
Title: Re: SubClass TabControl
Post by: LarryMc on September 05, 2008, 07:30:46 AM
Different approach:

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

Larry