Solved

Notification after doing a NextRecord() in ODBC

Posted on 2002-06-03
11
162 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
  • 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 49

Accepted Solution

by:
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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
configuration management 2 100
bobThere java chalenge 45 85
pre4 challenge 19 88
sumHeights2  challenge 7 78
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now