Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2006

Tip: Looking for answers? Try searching our database.

How to make a listview static .. .ie no user can use it.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gerry.brennan@gmail.com - 03 May 2006 15:28 GMT
Is it possible to stop  user from interacting /editing/ changing data/
changing look  with a list view.

Gerry.
William DePalo [MVP VC++] - 03 May 2006 15:42 GMT
> Is it possible to stop  user from interacting /editing/ changing data/
> changing look  with a list view.

You'd probably be better off posting again in the user interface group:

   microsoft.public.win32.programmer.ui

That said, there usually are at least two ways to do something like this.

One is to disable the control - check the docs for EnableWindow().

The other is to subclass the control - possibly subverting the handling of
keyboard and mouse input.

Regards,
Will
Bruno van Dooren - 03 May 2006 15:51 GMT
> Is it possible to stop  user from interacting /editing/ changing data/
> changing look  with a list view.

Hi Gerry,
Assuming you mean the .NET ListView control, you can simply set the Enabled
property to false.
that will prevent the user from interacting with it in any way.

Signature

Kind regards,
   Bruno.
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"

gerry.brennan@gmail.com - 03 May 2006 17:40 GMT
Hi Bruno,

I have tried the enabled property ... how ever the items in the grid
change colour to a different colour.
William DePalo [MVP VC++] - 03 May 2006 20:56 GMT
> I have tried the enabled property ... how ever the items in the grid
> change colour to a different colour.

That's a visual cue to the user informing him that the control is disabled.

Regards,
Will
gerry.brennan@gmail.com - 04 May 2006 13:50 GMT
I want the listview control to "visually look the same" as an enabled
control,
But yet the use can not do stuff like edtit  cells or resize
gridcolumns etc etc...
William DePalo [MVP VC++] - 04 May 2006 16:00 GMT
>I want the listview control to "visually look the same" as an enabled
> control,
> But yet the use can not do stuff like edtit  cells or resize
> gridcolumns etc etc...

I understand. As I said, using the native API, you'd accomplish that by
subclassing the control.

Sorry, but I don't know what your .Net options are.

Regards,
Will
Tamas Demjen - 04 May 2006 17:27 GMT
> I want the listview control to "visually look the same" as an enabled
> control,
> But yet the use can not do stuff like edtit  cells or resize
> gridcolumns etc etc...

In .NET, set LabelEdit = false to prevent editing of item captions. I
don't think you can disable header column resizing, but you can disable
header click, and hide the header columns altogether, with the
HeaderStyle property. You can try to handle the MouseDown event, and if
the mouse is on top of a column, just discard the window message.

Actually I don't believe it's a good idea to disable header resizing --
your customers will hate you for that. It's like disabling the scrolling
of items. What if a caption is too long and the user has a wide screen
monitor, or they use a larger than normal font? You gotta allow such
basic operations.

Ultimately you can do anything by painting to the screen directly. Start
with a Panel control and paint whatever you wish on top of it.

Tom

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.