From: dgwin32 on
I'm using mingw/gcc and writing a WIN32 app, or trying to...

Does anyone have an example of a custom control which
shows custom popup windows? I'm trying to recreate create a colour picker
button which
when pressed will display a popup panel to the side of the button showing a
grid of
255 colours which can be selected
(similar to this
http://www.adobe.com/devnet/dreamweaver/golive_migration/images/css_fig08.jpg)


I have registered two classes "ColourPicker" for the actual button which
I'm drawing myself, and "ColourPalette" which I will paint the grid of
colours on it
when i get it working.

I seem to have 3 problems with my code:
1) When the MDI window is moved the popup window stays where it is and
doesnt move with the control.
2) Being a popup window is doesn't get clipped with my MDI frame when the
window is resized.
3) calling GetParent() in the ColourPalette callback doesnt seem to point to
the ColourPicker window.

Does anyone know if the controls like combo boxes use popups to display
their dropdown lists in or are
the doing something different? Any help would be apprecitated.

Thanks.







--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: Alf P. Steinbach /Usenet on
* dgwin32, on 25.06.2010 13:19:
> I'm using mingw/gcc and writing a WIN32 app, or trying to...
>
> Does anyone have an example of a custom control which
> shows custom popup windows? I'm trying to recreate create a colour picker
> button which
> when pressed will display a popup panel to the side of the button showing a
> grid of
> 255 colours which can be selected
> (similar to this
> http://www.adobe.com/devnet/dreamweaver/golive_migration/images/css_fig08.jpg)
>
>
> I have registered two classes "ColourPicker" for the actual button which
> I'm drawing myself, and "ColourPalette" which I will paint the grid of
> colours on it
> when i get it working.
>
> I seem to have 3 problems with my code:
> 1) When the MDI window is moved the popup window stays where it is and
> doesnt move with the control.
> 2) Being a popup window is doesn't get clipped with my MDI frame when the
> window is resized.
> 3) calling GetParent() in the ColourPalette callback doesnt seem to point to
> the ColourPicker window.
>
> Does anyone know if the controls like combo boxes use popups to display
> their dropdown lists

Yes.


> in or are
> the doing something different? Any help would be apprecitated.

The easiest would be to display a modal dialog.

E.g. use the Windows color picker common dialog.


Cheers & hth.,

- Alf


--
blog at <url: http://alfps.wordpress.com>
From: dgwin32 on
> The easiest would be to display a modal dialog.
>
> E.g. use the Windows color picker common dialog.
>

Humm, yeah, but thats like someone saying:
"How do I work out 42+6", and then someone saying: "Use a calculator its
easier."







--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: winapi on
> 1) When the MDI window is moved the popup window stays where it is and
> doesnt move with the control.

WM_MOVE:
GetWindowRect(Parent, &rect);
MoveWindow(popUp, rect.right-offset, rect.bottom-offset, width, height,
TRUE);
return 0;



From: Alf P. Steinbach /Usenet on
* dgwin32, on 25.06.2010 20:45:
>> The easiest would be to display a modal dialog.
>>
>> E.g. use the Windows color picker common dialog.
>>
>
> Humm, yeah, but thats like someone saying:
> "How do I work out 42+6", and then someone saying: "Use a calculator its
> easier."

I'd say, google it.

Google reports "42 + 6 = 48", and displays a calculator icon as a hint.

Googling "color picker xp" yielded e.g. <url:
http://www.codeproject.com/kb/wtl/wtlcolorbutton.aspx>

Anyway, the main clue to your problem that the control doesn't follow the window
when the window is moved around, is that for its pop-up manifestation it needs
to be like a menu: click anywhere else and it disappears (so you can't move the
window while the control is up).

Then you can let the user "pin" the control down, where programmatically you
replace it with a child window, or you can let the user "tear" the control off,
where you programmatically replace it with a tool window (half height title), or
you can let the user "drag" it into a toolbar, whatever.

But as a newly popped up popup it needs to be kinda modal, where the only
interaction with anything not the control is to dismiss the control.

By the way, while you're into user interface "improvement" you may find it
interesting to implement some functionality that perhaps should have been
standard, such as allowing minimization of a main window while a modal dialog is
up, such as always having a "cancel" choice at top of every pop up menu, and
such as always presenting a "show clipboard" in every edit menu. There are
technical challenges in all of this. For more advanced/harder challenge,
consider pie menus: they're reportedly much more efficient for the user. :-)


Cheers & hth.,

- Alf

--
blog at <url: http://alfps.wordpress.com>