473,657 Members | 2,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListView - Get Items Highlighted Text While In Edit Mode

ListView is in Detailed Mode, and an Item is in EditMode
(ListViewItem.B eginEdit()), how, if any, would I get the currently
highlighted portion of the text?

Basically I have a ctrl-c shortcut that copies the entire line of the
currently selected items, however, if the user is in Edit Mode I'd
like it just to copy what the user has selected (IE Default Behavior
of Ctrl-C). If I ignore my copy method, "if(InEditM ode) return;" then
the default behavior doesn't trigger; I'd need a "if(InEditM ode)
{Handled=false; return;}" type thing which doesn't exist I don't
think, so now I'm trying to do "if(InEditM ode) Copy Highlighted
Portion of listView1.Selec tedItem[0].Text".

Another way would be when entering edit mode to do
"copyMenuItem.S hortCutKeys = Keys.None;" and in the "AfterItemE dit
Event" do "copyMenuItem.S hortCutKeys = origKeys", however, I don't
like how the shortcut disappears in the menu with this method.

Is there an easy/simple alternative to my problem (select currently
highlight text method someplace? Something special with the ShortCut
system I can do with sender maybe to say I never handled the event and
to keep propgating it? Or something else to this problem that I don't
know about?

Thanks
Sep 10 '08 #1
1 2594
On Sep 10, 11:13*am, NvrBst <nvr...@gmail.c omwrote:
ListView is in Detailed Mode, and an Item is in EditMode
(ListViewItem.B eginEdit()), how, if any, would I get the currently
highlighted portion of the text?

Basically I have a ctrl-c shortcut that copies the entire line of the
currently selected items, however, if the user is in Edit Mode I'd
like it just to copy what the user has selected (IE Default Behavior
of Ctrl-C). *If I ignore my copy method, "if(InEditM ode) return;" then
the default behavior doesn't trigger; I'd need a "if(InEditM ode)
{Handled=false; return;}" type thing which doesn't exist I don't
think, so now I'm trying to do "if(InEditM ode) Copy Highlighted
Portion of listView1.Selec tedItem[0].Text".

Another way would be when entering edit mode to do
"copyMenuItem.S hortCutKeys = Keys.None;" and in the "AfterItemE dit
Event" do "copyMenuItem.S hortCutKeys = origKeys", however, I don't
like how the shortcut disappears in the menu with this method.

Is there an easy/simple alternative to my problem (select currently
highlight text method someplace? Something special with the ShortCut
system I can do with sender maybe to say I never handled the event and
to keep propgating it? *Or something else to this problem that I don't
know about?

Thanks
Setting "copyMenuItem.E nabled = false;" and "copyMenuItem.E nabled =
true" is cleaner than re-setting the ShortCutKeys, and works better.
For future reference, I'd love to know how to grab the currently
selected/highlighted text on a Textbox/ListViewItem, etc. I assume
there has to be a .NET class (like Clipboard) which stores the
highlighted portion someplace?

Thanks
Sep 12 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9297
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data, checkbox's and icons are displayed as they are meant to be. My problem is this, I am trying to achieve the same results as I get with CheckListBox(s), where I am able to select (Check-mark) various checkboxs items and able to alter the data. I do...
1
5042
by: cider123 | last post by:
I've tried working with the SelectedIndices and Items.Selected attributes to get the problem to go away, but not having any luck. Questions I have are: 1) How do you move (using code) the focus Rectangle when your Selected Index changes ? 2) If there are no selected rows, can that focus rectangle be removed? 3) What other quirks exist in this simple example I might need to code for ?
10
1879
by: HABJAN ®iga | last post by:
Ok, the trouble: On form: Mask (lots of textboxes & ...) Listview 1 as Listview with some items booEdit as boolean=False intEditIndex as integer Scenario:
1
4017
by: Shane | last post by:
I have a text box select items in a listview as text is being typed into the text box. I get the select bar to move correctly in the Listview control. If the user presses the down or up key in the text box, I want to move to the selected item in the listview box. The down or up arrow does set focus to the listview box and the selected item switches from the grey of being unfocused to the blue of focus. So far, so good.
4
4947
by: Shane | last post by:
I have a text box select items in a listview as text is being typed into the text box. I get the select bar to move correctly in the Listview control. If the user presses the down or up key in the text box, I want to move to the selected item in the listview box. The down or up arrow does set focus to the listview box and the selected item switches from the grey of being unfocused to the blue of focus. So far, so good.
21
5197
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each table and 11 sub items with data about each column. When a Row in ListView1 is selected the Data in ListVies2 is loaded to show the correct data. Initially the first row in ListView1 is selected in FormX load
12
3107
by: Dennis | last post by:
I have a form which has a ListView control named ListView1 added at design time. When I add items using the following code, they don't appear in the list view. However, if I create a ListView control in code and add it to the form, it works. Why don't the items show up in the ListView that I added at desgn time. ' Create three items and three sets of subitems for each item. Dim item1 As New ListViewItem("item1", 0) ' Place a check...
6
3400
by: Nick | last post by:
Hi there, I'm trying to implement drag-drop for my listview control in large icon view mode. Unfortunately the order of the items gets completely messed up upon inserting the item back into the listview, removing the item obviously keeps everything fine but the second I use insert the item is added to the *end* of the listview. Does anyone have any tips on how I can solve this issue?? Call Items.Remove(SourceItem)
6
5659
by: Rich Raffenetti | last post by:
I have a form with a listview control and a textbox. When I change focus from the listview to the textbox, the highlighted item on the listview loses the highlight. That is not the behavior I need. I am using VB2008 express. I see that the behavior of a similar program in VB6 is the same. When the controls are a listbox and a textbox, the highlighted item remains highlighted when changing focus to the textbox. So I might guess that...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.