Solved

SetTimer Function call ...

Posted on 1998-10-12
5
186 Views
Last Modified: 2013-11-20
Is there someone out there who can give me an example of the CListBox.SetTimer(), CListBox.OnTimer() and CListBox.KillTimer()?
0
Comment
Question by:ndb
5 Comments
 
LVL 2

Expert Comment

by:jrmcg
ID: 1323203
What exactly are you trying to do?  The CListBox does not have a timer function of its own that I am aware of.  I can help you write a Timer if you will tell me what you want to do with it... with respect to the CListBox.

J.R.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1323204
These are members of CWnd, the base class of CListBox (and a lot of other classes too, such as CView).

Look for examples of CWnd::SetTimer
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1323205
Typically, the timer is set within the controlling window's message loop and not within the control itself.  Then on the OnTimer, you will update the list box accordingly.  Otherwise, you'll will have to override the CListBox with a class of your own.

Phillip
0
 
LVL 1

Author Comment

by:ndb
ID: 1323206
I want to create some kind of buffer. When a user presses a key then a stringbuffer is created related to a timer. That buffer stays active for 1sec and is destroyed again unless the user pressed a key within that 1sec. The the timer is restarted again.
0
 
LVL 7

Accepted Solution

by:
psdavis earned 100 total points
ID: 1323207
Alright, here's some pseudo-code.  I call it pseudo code in case I make a mistake :)

#define ID_TIMER_ON_CHAR  WM_USER + 102

CMyListBox::OnChar( )
{
.
   SetTimer( ID_TIMER_ON_CHAR, 1000, NULL );
}

// Override the WM_TIMER

void CMyListBox::OnTimer( UINT uiEvent )
{
   if( uiEvent == ID_TIMER_ON_CHAR )
   {
   // do what you want here!
      KillTimer( ID_TIMER_ON_CHAR );
   }

   CListBox::OnTimer( uiEvent );
   return;
}

Phillip
}

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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