nanogui: Changing display font in pushbutton control


Previous by date: 21 Feb 2007 07:04:47 +0000 Re: rotate mouse movements 90 degree in nano-X, jasinski.utfpr.edu.br
Next by date: 21 Feb 2007 07:04:47 +0000 Win32 supported APIs, abhishek desai
Previous in thread: 21 Feb 2007 07:04:47 +0000 Re: Changing display font in pushbutton control, jasinski.utfpr.edu.br
Next in thread: 21 Feb 2007 07:04:47 +0000 Re: Changing display font in pushbutton control, Greg Haerr

Subject: Re: [nanogui] Changing display font in pushbutton control
From: "Uwe Klatt" ####@####.####
Date: 21 Feb 2007 07:04:47 +0000
Message-Id: <003e01c75586$7e808900$081710ac@arnstein.miwe.de>

Hello Ricardo,

> 4) Now this was a little tricky; I had to change the SET_PBFONT and
> GET_PBFONT macros from:
>       #define SET_PBFONT(h,x)  (SetWindowWord(h, 8, x))
>       #define GET_PBFONT(h)    (GetWindowWord(h, 8))
>   to:
>       #define SET_PBFONT(h,x)  (SetWindowLong(h, 8, x))
>       #define GET_PBFONT(h)    (GetWindowLong(h, 8))
>   since the pointers in my system are 32 bits long. As a consequence,
> I had to change the number of extra bytes (wc.cbWndExtra) from 10 to
> 12. Hope there's no problem with that. Actually, aren't most of them
> 32-bit nowadays?

Another way I use:

When creating a new Window (button) and need extra per window data, I 
allocate memory for my own memory object (e.g. struct MYDATASTRUCT). This 
can be done in WM_CREATE.

This structure can be modified from time to time without thinking about size 
of extradata.

After creating a new window you need only a
  SetWindowLong(hWnd,GWL_USERDATA,(LPARAM)pMydata);
for adding your additional data to this window.

When you need this data inside of the window proc, you can use similar:
  pMydata = (MYDATASTRUCT *)GetWindowLong(hWnd,GWL_USERDATA);

When destroying the window, you should destroy this memory object too. (Can 
be one in WM_DESTROY).

Bye
Uwe 


Previous by date: 21 Feb 2007 07:04:47 +0000 Re: rotate mouse movements 90 degree in nano-X, jasinski.utfpr.edu.br
Next by date: 21 Feb 2007 07:04:47 +0000 Win32 supported APIs, abhishek desai
Previous in thread: 21 Feb 2007 07:04:47 +0000 Re: Changing display font in pushbutton control, jasinski.utfpr.edu.br
Next in thread: 21 Feb 2007 07:04:47 +0000 Re: Changing display font in pushbutton control, Greg Haerr


Powered by ezmlm-browse 0.20.