Notification after doing a NextRecord() in ODBC

Posted on 2002-06-03
Last Modified: 2013-11-20
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.
Question by:pigeonbr
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
LVL 49

Expert Comment

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

Author Comment

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 just doesn't work....I await your suggestionss...thanks in advance!

Author Comment

ID: 7055929
DanRollins: 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 action taken by user....I think this way of explaining it may be clearer...thanks...
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

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)
      DDX_Text(pDX, IDC_EDIT1, m_sLastName);
      DDX_Text(pDX, IDC_EDIT2, m_sFirstName);
   // ----------------- add this code:
   if ( pDX->m_bSaveAndValidate == 0 ) {
       MessageBox( "data is going into the edit boxes" );

I hope that helps.
-- Dan

Author Comment

ID: 7057293

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!
LVL 49

Accepted Solution

DanRollins earned 100 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

Author Comment

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


     HRESULT hr = m_cpicCustomer.m_IPicture2->get_Handle((OLE_HANDLE*)&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.


Author Comment

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.

Author Comment

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

Expert Comment

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

Author Comment

ID: 7060473
Thanks again !Until next time perhaps.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sum13 challenge 24 148
pre4 challenge 19 115
x-bar in Google Sheets 2 126
Increment column based of a FK 8 67
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

732 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