473,396 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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::GetCurrentMessage();
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=ObPanelAPI::GetControlHandleByName(&(1:)) ;
if (HwndGrid){
LONG lCurCell = HGGetCurSel(HwndGrid);

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

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

unsigned long lMarker = SendMessage(HwndGrid, 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(HwndGrid, iMarCol, iMarRow);
}}

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

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

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

Similar topics

3
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...
5
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...
2
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();...
1
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
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...
10
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...
3
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...
0
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.