|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to capture Mouse clicks and Keystrokes in a VB appI need to build a very simple text editor. The requirement is that the input screen should be divided into 'm*n' cells ('m' rows, 'n' columns, with each cell of a fixed size). Whenever the user wants to input text, he will click on one of these cells, and then enter the text. The text should then be visible inside the cell. From my very limited knowledge of VB, I plan to use the 'group box' construct to denote one cell. Now, here is where I need your help. 1. How do I create 'm*n' 'group boxes' on the fly (some kind of a nested for loop ?) 2. How do I know when a user has clicked on a 'group box' ? 3. For every 'group box', I need to allocate a buffer to store the characters that the user has entered for that particular cell. How can this be done ? Thanks. In article <FED1D017-901D-4442-938F-0BC139AA4***@microsoft.com>,
T*@discussions.microsoft.com says... > Hello, A group box is for "grouping" related controls in a pretty frame. It > > I need to build a very simple text editor. The requirement is that > the input screen should be divided into 'm*n' cells ('m' rows, 'n' > columns, with each cell of a fixed size). Whenever the user wants to > input text, he will click on one of these cells, and then enter the > text. The text should then be visible inside the cell. > > From my very limited knowledge of VB, I plan to use the 'group box' > construct to denote one cell. Now, here is where I need your help. doesn't provide any support for text input. I think you want a textbox. Or, if you want a "grid" of cells, use the DataGridView (.NET 2.0 only). > 1. How do I create 'm*n' 'group boxes' on the fly (some kind of a Yeah, a nested for loop would work:> nested for loop ?) for x = 1 to m for y = 1 to n dim tb as TextBox = New TextBox() tb.Location = new Point(20*x, 30*y) tb.Size = new Size(20,30) Me.Controls.Add(tb) next y next x > 2. How do I know when a user has clicked on a 'group box' ? The groupbox doesn't support a "clicked" event since it's just a container control. If you had a textbox, capture the "Click" event. > 3. For every 'group box', I need to allocate a buffer to store the Just use a textbox and let the control hold on to the text. :)> characters that the user has entered for that particular cell. How > can this be done ? Thanks for the reply. Based on it, I have the following question.
Show quoteHide quote "Patrick Steele" wrote: I need to write my own text handling controls. That's because I am > In article <FED1D017-901D-4442-938F-0BC139AA4***@microsoft.com>, > T*@discussions.microsoft.com says... > > Hello, > > > > I need to build a very simple text editor. The requirement is that > > the input screen should be divided into 'm*n' cells ('m' rows, 'n' > > columns, with each cell of a fixed size). Whenever the user wants to > > input text, he will click on one of these cells, and then enter the > > text. The text should then be visible inside the cell. > > > > From my very limited knowledge of VB, I plan to use the 'group box' > > construct to denote one cell. Now, here is where I need your help. > > A group box is for "grouping" related controls in a pretty frame. It > doesn't provide any support for text input. I think you want a textbox. > Or, if you want a "grid" of cells, use the DataGridView (.NET 2.0 only). > designing this editor to input text that can come in any combination. For example, when the user types 'a', followed by a '/', followed by a 'b', my editor should display it as 'a' sitting vertically above 'b'. I think the Microsoft GDI routine DrawString() can be used to do this. So, basically for each cell I will have to store a sequence of tuples of the form <x,y,c> where x and y are the coordinates of the point, and c is the character at that point. A text box might not support this kind of a feature. If the 'groupbox' control does not allow me to capture keyboard/mouse interrupts then what do I use. Is there any control which would offer me this free form writing anywhere within a given cell. Show quoteHide quote > > 1. How do I create 'm*n' 'group boxes' on the fly (some kind of a > > nested for loop ?) > > Yeah, a nested for loop would work: > > for x = 1 to m > for y = 1 to n > dim tb as TextBox = New TextBox() > tb.Location = new Point(20*x, 30*y) > tb.Size = new Size(20,30) > Me.Controls.Add(tb) > next y > next x > > > 2. How do I know when a user has clicked on a 'group box' ? > > The groupbox doesn't support a "clicked" event since it's just a > container control. If you had a textbox, capture the "Click" event. > > > 3. For every 'group box', I need to allocate a buffer to store the > > characters that the user has entered for that particular cell. How > > can this be done ? > > Just use a textbox and let the control hold on to the text. :) > > -- > Patrick Steele > http://weblogs.asp.net/psteele >
Copying from one Database to another VB 2005
Empty string comparisons Outlook PST Files Poor performance IDE. Urgent suggestion needed. SQL staments with ADO in Excell Sending CHR(7) to cash drawer to Open Security and file permissions.... Start up form Pulling data objects from a collection of various data types stored webservice function |
|||||||||||||||||||||||