NO

Author Topic: Simple DataGridView custom control for Pelles C  (Read 6280 times)

Offline DMac

  • Member
  • *
  • Posts: 272
Simple DataGridView custom control for Pelles C
« on: October 24, 2007, 08:33:58 PM »
The attached project demonstrates how to create a simple custom control in Pelles C (simple as in not drawing everything from scratch).  I wanted an editable list view and threw in some other customizations as a bonus.  The header file contains macroes for each custom message that demonstrate the usage of the messages.  Also many ListView related messages can be used with this control (all list view messages are forwarded to the list view component.)
No one cares how much you know,
until they know how much you care.

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Simple DataGridView custom control for Pelles C
« Reply #1 on: October 24, 2007, 09:37:08 PM »
That is really useful 8)

Thanks for sharing ;D
---
Stefan

Proud member of the UltraDefrag Development Team

JohnF

  • Guest
Re: Simple DataGridView custom control for Pelles C
« Reply #2 on: October 25, 2007, 07:39:20 AM »
I get an error when compiling

---------------
DataGridView.c(1354): error #3114: [asm] Invalid combination of opcode and operands.
*** Error code: 1 ***
---------------

Any ideas on how to correct that?

edit:

OOPS, I didn't have the latest PellesC.

Anyway, nice contribution, thanks.

John
« Last Edit: October 25, 2007, 10:53:38 AM by JohnF »

Offline DMac

  • Member
  • *
  • Posts: 272
Re: Simple DataGridView custom control for Pelles C
« Reply #3 on: October 25, 2007, 06:28:47 PM »
Stephan,
Glad you find this useful.

John,
Surprisingly, most of the time I spent on this was getting the scrolling to work right.  I ended up having to store scroll info in my struct instead of using GetScrollInfo() it seems that once the scroll bars disappear the control's scroll info is cleared.

DMac
No one cares how much you know,
until they know how much you care.

JohnF

  • Guest
Re: Simple DataGridView custom control for Pelles C
« Reply #4 on: October 25, 2007, 10:40:10 PM »
John,
Surprisingly, most of the time I spent on this was getting the scrolling to work right.  I ended up having to store scroll info in my struct instead of using GetScrollInfo() it seems that once the scroll bars disappear the control's scroll info is cleared.

DMac

I've used GetScrollInfo a few times but I don't know what you mean by 'scroll bars disappear'. However you seem to have managed it fine.

John

Offline DMac

  • Member
  • *
  • Posts: 272
Re: Simple DataGridView custom control for Pelles C
« Reply #5 on: October 25, 2007, 11:59:41 PM »
Quote
I've used GetScrollInfo a few times but I don't know what you mean by 'scroll bars disappear'.

Here's the scenario,

1.  User scrolls the control to the last collumn.

2.  User then chooses to stretch window to see all grid.

3.  Scroll bars go away because the window size is greater than the page size.
Unfortunately the window might not be aligned with the Grid.

At this point I want to pan the view so that the top left of the grid is the top left of the control but unfortunately GetScrollInfo() returns an empty structure.

The solution was to store the scroll info independent of the Control's window.
No one cares how much you know,
until they know how much you care.

JohnF

  • Guest
Re: Simple DataGridView custom control for Pelles C
« Reply #6 on: October 26, 2007, 07:36:52 AM »
Ok I see now. I guess the best way is to scroll the window as the user is stretching so that when the scroll bar finally disappears the window is in the right place.

Btw, I had to adjust MainDlg_OnSize() as the buttons were encroaching on the grid, I use 120 DPI screen setting.

John