473,763 Members | 7,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set focus on next column

I am using a C++ source code generator from Computer Associates, called
Allfusion Plex, and need to insert source code to set focus on the next
editable cell in a grid. For example, I have a maintenable grid with four
columns. The first column is read only and tab stop is set to No. The
second and third columns are editable and tab stop is set to Yes. The
fourth and last column is editable but the tab stop is to No. I am
currently using source code to trap the tab key pressed event. I need the
source code to set focus to the next editable column with tab stop yes,
which can be on the next row if the cursor is in the last editable column in
the current row. Also, I will need to be able to tab backwards. Here is an
example of the source code I am using but it does not work as previously
described.

{
// 1. Get Current Message for Trapped Control
MSG *pMessage = ObAppAPI::GetCu rrentMessage();
int iNtfcCode = HIWORD( pMessage->wParam );

if( iNtfcCode == HGN_SELCHANGING ){
// 2. Get Key Pressed State for Needed Keys
int iShftKey = 0;
if( GetKeyState(VK_ SHIFT) & 0x80 ){
iShftKey = 1;
}

int iPrsdKey = 0;
if( GetKeyState(VK_ TAB) & 0x80 ){
iPrsdKey = VK_TAB;
}else{ if( GetKeyState(VK_ RETURN) & 0x80 ){
iPrsdKey = VK_RETURN;
}else{ if( GetKeyState(VK_ F5) & 0x80 ){
iPrsdKey = VK_F5;
}else{ if( GetKeyState(VK_ F6) & 0x80 ){
iPrsdKey = VK_F6;
} }}}

// 3. Process User Input
if( iPrsdKey != 0 ){
HWND HwndGrid=ObPane lAPI::GetContro lHandleByName(& (1:));
if (HwndGrid){
LONG lCurCell = HGGetCurSel(Hwn dGrid);

int iCurCol = CELLCOL( lCurCell );
int iCurRow = CELLROW( lCurCell );

int iColCnt = SendMessage(Hwn dGrid, HGM_GETCOLCOUNT , 0, 0L);
int iRowCnt = SendMessage(Hwn dGrid, HGM_GETROWCOUNT , 0, 0L);

unsigned long lMarker = SendMessage(Hwn dGrid, HGM_GETMARKER, 0, 0L);
int iMarCol, iMarRow;
iMarCol = LOWORD(lMarker) ;
iMarRow = HIWORD(lMarker) ;

if( iPrsdKey == VK_TAB ){
if( iColCnt == (iCurCol+1) ){
if( iCurCol == iMarCol ){
iMarCol = 0;
if( ++iMarRow >= iRowCnt ){ iMarRow = 0; }
HGSetCurSel(Hwn dGrid, iMarCol, iMarRow);
}}

}else{ if( iPrsdKey == VK_RETURN ){
iMarCol = 0;
HGSetCurSel(Hwn dGrid, iMarCol, iMarRow);
} }

}
}
}
}
Nov 17 '05 #1
0 1164

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

Similar topics

3
8005
by: Daisy | last post by:
I've started writing a listview, which currently draws my list to a pane, and onclick, works out which row you've clicked on, from the co-ordinates of the mouse, sets the .Selected property to the index of the item in my list, and onpaint, I draw this with a selected box over it. It's dawned on me, that this "list", being just text written to the pane, won't be able to recieve focus, and therefore, there's probably a better way of doing...
5
4367
by: Bryan Masephol | last post by:
Hi All I got a datagrid and a ComboBox on a form. I populate the combobox with years for all the data avaiable. When the user chooses a year the datagrid is populated with the specific years information. Problem... when the users scrolls the datagrid with the mouse wheel it work for 2 wheel clicks and then for some reason the focus jumps to the combobox and the year is then changes there for causing the data to change and errors...
2
2492
by: Bill C. | last post by:
Hi, I'm trying to implement a ComboBox drop-down column for a DataGrid. When a cell is selected in the ComboBox column I overlay a ComboBox over the cell and call: this.comboBox.Show(); this.comboBox.BringToFront(); this.comboBox.Focus();
1
3417
by: J.H.. | last post by:
With who way I can remove the focus from a DataGrid Control using the key Tab in a WinForm in C# ? The key Tab transports the focus in the next column of DataGrid and no in the next WinForm Control.
1
4416
by: J.H.. | last post by:
With who way I can remove the focus from a DataGrid Control using the key Tab in a WinForm in C# ? The key Tab transports the focus in the next column of DataGrid and no in the next WinForm Control.? Thanks
10
3061
by: Perry van Kuppeveld | last post by:
Hi, I have a problem with formatting a table including text fields wich can contain up to 255 chars. I need a table with 3 columns: - First column 50 % over the with a rowspan of the total number of rows. - Second column 25 %, no rowspan - Third column 25 %, no rowspan
3
1731
by: tlyczko | last post by:
I have this code in a form input box contained in the 4th column cell of a 4-column table: onblur = "if (testExp(this.value, 'message') == false) {window.focus(); this.focus();}" testExp checks the input box form value, but every time it is false (wrong kind of value), the focus goes to the form input box in the 1st column of the *next* table row.
0
1144
by: jereviscious | last post by:
Hi all I've added a combobox to the datagrid control using the following method dataGridTextBoxColumn7.TextBox.Controls.Add(comboControl); The problem is that when I tab to the Column that contains the combobox, the focus is on the underlying textbox in the datagrid.
7
17755
by: Orv | last post by:
I have a "Yes/No" combo box (set to required) and I want the focus to shift to differnet controls (on the same form) based on the selection of "Yes" or "No". Would this have to be placed on the "Exit" event? I tried Google...and no luck. I'm sure there's gonna be an "If" statement involved. TIA, -Orv Access2003
0
9564
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
9387
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
10148
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...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7368
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
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
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...
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.