Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Notification after doing a NextRecord() in ODBC

Posted on 2002-06-03
11
Medium Priority
?
169 Views
Last Modified: 2013-11-20
Hi;
In ODBC, is there a handler or notification that you can use to do something AFTER the Move() has changed records AND AFTER having diplayed the new data in an edit control, which I want to use? I only want to know when the new data in in a certain edit control and can't find a way to use this condition. Thanks! EN_CHANGE and EN_UPDATE don't do this exact thing.
0
Comment
Question by:pigeonbr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 7055856
>>I only want to know when the new data in in a certain
>> edit control and can't find a way to use this condition

Do you mean that after you have transferred data ftom a recordset to a screen element, you want to know if it is different from what was previously there?

Describe the mechanisms that you are using to obtain the data and to display it.  It seems a simple matter to compare the new value to the old right before you store the text into the edit control.  Since it seems so simple, I think I must not understand the question so please elaborate.

-- Dan
0
 

Author Comment

by:pigeonbr
ID: 7055918
DanRollins; Hi!
Ok...What I want to do is this: When I go to another record using the toolbar arrows in ODBC app, and a certain edit control displays a new value(int), I want to automatically get that number when it comes up and use the number to do something else, and this every time I change records. I can't find a NM_ or EN_ that gives me this condition back; only conditions like when the user changes something in the edit control...the code I need for my app to do something when it gets this new value is made and works,...all I need is the mechanics of where to put it or how to call it for this to work...I tried putting it in the DoDataExchange function and use it after a count of two times having gone thru the function which is the condition I need, but seems like you can't put code in there that needs to read an edit control, like doing this:
CString strEditControl = m_pSet->m_EditControlValue;....if you see what I mean....it just doesn't work....I await your suggestionss...thanks in advance!
0
 

Author Comment

by:pigeonbr
ID: 7055929
DanRollins:
....in other words, I need a trigger that when the value changes in the edit control, some code is executed automatically, without having to click something or somewhere..no action taken by user....I think this way of explaining it may be clearer...thanks...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 49

Expert Comment

by:DanRollins
ID: 7056745
There is nothing like an automatic trigger or notification sent when the contents of an edit control are changed programatically.  Messages such as EN_CHANGE occur when the *user* changes the contents, not when the program changes the contents.

Your program is changing the contents of the edit control in the DoDataExchange function.  You can easily monitor for activity there.  For instance:

void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
   CDialog::DoDataExchange(pDX);
   //{{AFX_DATA_MAP(CPenWidthsDlg)
      DDX_Text(pDX, IDC_EDIT1, m_sLastName);
      DDX_Text(pDX, IDC_EDIT2, m_sFirstName);
   //}}AFX_DATA_MAP
   // ----------------- add this code:
   if ( pDX->m_bSaveAndValidate == 0 ) {
       MessageBox( "data is going into the edit boxes" );
   }
}

I hope that helps.
-- Dan
0
 

Author Comment

by:pigeonbr
ID: 7057293
DanRollins;

YEs, I know about using the m_bSaveAndValidate, but as you sais, the data "is going" into the edit boxes...I need to know " once it is in" the edit box. If such a condition is not available, I'll see what I can come up with...all I want to do is display a .jpg that has the same name as a number in the edit box in question. Any further comment will be gladly accepted. If there is no way to do it this way, I will delete the question and look for other alternatives. Thanks!
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 400 total points
ID: 7057396
At that point, the value of the variable (for instance, m_sLastName) contains the text that will be visible in the Edit control in a few nanoseconds.  

If I understand you correctly, then as soon as you know what will be in the edit box, you can read a jpg file.  Right?  So something like:

if ( pDX->m_bSaveAndValidate == 0 ) {
      CString sFile= "c:\\images\\";
      sFile += m_sLastName;
      sFile += ".jpg";
      DoSomethingWithTheJpgFile( sFile );
  }

If I don't undertand waht you want to do, then please explain.

-- Dan
0
 

Author Comment

by:pigeonbr
ID: 7057840
DanRollins:
Hi ! Looks like you understood fine....here is my code..:
     //***************************************
     CString strNoClient = m_pSet->m_No_client;
     CString strFrontString ="c:\\photos\\";
     CString strWholeString = (strFrontString + strNoClient+".jpg");

     m_cpicCustomer.FreePicture2Data();
     m_cpicCustomer.Load(strWholeString);


     HRESULT hr = m_cpicCustomer.m_IPicture2->get_Handle((OLE_HANDLE*)&m_hbmpCustomer);

m_ctlPicBmp.SetBitmap(m_hbmpCustomer);
     //**********************************************

I want to get the value fron an edit box m_pSet->m_No_client which is a number like 1234, then load a corresponding existing .jpg already named 1234.jpg, and I display it in a standard Picture control. But the trick is getting the .jpg to load automatically when user changes records with the ODBC arrow controls in the toolbar... If I can get things working if I have the user intervene by using say the CViews WM_MOUSEMOVE message...but the user has to bring the mouse down from the toolbar into the view, and this loads the correct .jpg...but it also uses system resources because while you are moving the mouse around the view doing other things, the .jpg is continually loading, but it doesnt show.

0
 

Author Comment

by:pigeonbr
ID: 7058938
DanRollins: Hi there
Got a way around the problem and it works great..maybe not as elegant as some would like..In the DoDataExchange() I used your suggestion of m_bSaveAndValidate to activate a flag(just a variable I put to 1 when DDX activity). I put a timer in the view by WM_TIMER, set it in OnInitialUpdate() to .1 seconds, but I don't display any time anywhere. Then in the OnTimer() i check my DDXActivity flag...if it is 1, I do my .jpg loading and displaying code...then put the flag back to zero...simple and stupid, but it works.Thanks for your time...the points are yours for the m_bSaveAndValidate.....thanks...let me know what you think of my solution if you have time.
0
 

Author Comment

by:pigeonbr
ID: 7058942
Thanks again...your comment led me to another way of thinking by which I solved my problem.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7060120
I often use that timer trick.  But I don't understand why you don't simply load the picture as I described -- right there in DoDataExchange(). In fact that location is designed to do exactly that:  Provide a means to cause incoming data to be rendered to the screen for user viewing.  Usually it just displays text, but it can make radio buttons and checkboxes change settings, update a slider control, change the selection in a combo box, etc.  This is just an extension of that logic:  An incoming string needs to be 'displayed as' a bitmap -- so you write a little underlying logic to do the file lookup, load the file, and make it visible on the screen.

I'm pretty sure that you have somehow confused the *display of the data* in an edit control with the *availability of the data* to the program.  

Anyway, I am glad that I hasve been able to help.

-- Dan
0
 

Author Comment

by:pigeonbr
ID: 7060473
Dan:
Thanks again !Until next time perhaps.
pigeonbr
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question