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

x
?
Solved

Handle cut & paste in a dialog window

Posted on 1999-01-01
2
Medium Priority
?
203 Views
Last Modified: 2013-12-26
how should I handle cut & paste in a dialog windows edit text controls?

void do_edit_cmds(short the_item)
{
 
  switch( the_item )
  {
     case editUNDO:
        if(SystemEdit( the_item - 1) )
         ;
        break;
     case editCUT:
        if(SystemEdit( the_item - 1) )
        ;//SysBeep(10);
        break;
     case editCOPY:
        if(SystemEdit( the_item - 1) )
        ;
        break;
    case editPASTE:
       if(SystemEdit( the_item - 1) )
       ;
       break;
    case editCLEAR:
       if(SystemEdit( the_item - 1) )
       ;
       break;
    case editSELECT_ALL:
       if(SystemEdit( the_item - 1) )
       ;
       break;
    case editPREFERENCE:
       Handle_Preferences();
       break;    
 }
}
0
Comment
Question by:gailp
[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
2 Comments
 
LVL 3

Accepted Solution

by:
boonstra earned 200 total points
ID: 1291689
You want to use the routines DialogCut, DialogCopy, and DialogPaste, each of which takes a single parameter, a pointer to the dialog you want to cut/copy/paste from.

Without seeing more of your event loop, it is difficult to provide specific code.  Assuming you are talking about a modeless dialog, if you know that your dialog is the frontmost window when you enter do_edit_cmds, you can simply:

WindowPtr wind;

wind = FrontWindow();
switch (the_item) {
  case editCut:
    DialogCut(wind);
    break;
  case editCopy:
    DialogCopy(wind);
    break;
  case editPaste:
    DialogPaste(wind);
    break;
}

You do not need to provide the item being edited, as the DialogManager already knows that and does the right thing.

If it is possible that some other window is frontmost when you call do_edit_cmds, then you'll want to use something like:

  case editCut:
    if (IsMyDialogWindow(wind)) DialogCut(wind);
    break;

where IsMyDialogWindow is code you provide to determine whether wind is one of your dialogs.
0
 

Author Comment

by:gailp
ID: 1291690
This answer worked for me.

Thank You for your help.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

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