May 11, 2024, 04:10:15 AM

News:

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


Rebars,Comboboxes and SetFont

Started by LarryMc, January 10, 2010, 04:54:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

I have a combox box that works fine when it is used normally.
I can change fonts and fontsize.
When it is assigned to a rebar it no longer displays properly if the fontsize is set to something other than 10.

When it's other than 10 there is no text displayed at all.

Any ideas?

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

sapero

Me again :) Try to forward WM_MEASUREITEM and WM_DRAWITEM to rebar parent from rebar subclass proc.
Optionally you can forward only when control id is one of your comboboxes.
ControlID is the second integer in MEASUREITEMSTRUCT and DRAWITEMSTRUCT, so you can check it indirectly:
' validate message
if ((message = WM_MEASUREITEM) or (message = WM_DRAWITEM))
   ' validate control id
   if (*<int>lParam[1] = controlid) ' <- second DWORD -> UINT CtlID
      return _SendMessage(GetParent(hwnd), message, wParam, lParam)
   endif
endif

By the way, the control should save owner window handle and use it for all notifications, instead calling each time GetParent.

LarryMc

Sapero

Here's what I tried but it didn't help with ny comboboxes.

sub RebarSubclassProc(hWnd:UINT, Msg:UINT, wParam:UINT, lParam:UINT),UINT
   UINT OriginalWndProc
   OriginalWndProc = GetWindowLong(hwnd, GWL_USERDATA)
   select Msg
      case WM_NOTIFY
if ((*<NMHDR>lParam.code = TTN_GETDISPINFOA) | (*<NMHDR>lParam.code = TTN_GETDISPINFOW))
return SendMessage(GetParent(hwnd), WM_NOTIFY, wParam, lParam)
endif
      case WM_DESTROY
         SetWindowLong(hwnd, GWL_WNDPROC, OriginalWndProc)
case WM_MEASUREITEM
case& WM_DRAWITEM
return SendMessage(GetParent(hwnd), Msg, wParam, lParam)
   endselect
   return CallWindowProc(OriginalWndProc, hWnd, Msg, wParam, lParam)
endsub


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

sapero

To give you a fast solution, I need more informations: how do you change the font, how do you ceate the combo. It is important because Ebasic library uses custom drawing stuff, and your case can be either raw-api, ebasic library based, or even mixed. Would be perfect with a sample code ready to modify/compile.

I assumed that your main window and combo is created with openwindow() and control(), but after the parent of combo changed, combo started pumping the ownerdrawn notifications to new parent window.

LarryMc

Sapero,
I think it is internal to EBasic, because i was using EB to set the font and EB to create the combobox.

I can create the effect I want by creating the toolbar with
CCS_NOPARENTALIGN|CCS_NORESIZE |CCS_NODIVIDER
for the toolbar and then positioning it where I want and positioning the combobox next to it so it looks like it's all together.

That way I don't have to use the rebar for multiple rows of toolbars.
It's a little crude way to code it but it works and is rock solid.

Thanks for the help.

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