Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - gets()
Page 1 of 1

PostPosted: Mon Feb 17, 2003 8:53 am
by aarc_qld
I have read through the forums about the problems quite a few people seem to be having with this. I have a similar problem, the input box is too small to show the input. Is there a solution besides writing a custom input function?

PostPosted: Mon Feb 17, 2003 9:35 am
by guy
A replacement for the gets() function. Call CreateInputDialogue() at the start of your program to initialise the dialogue box (you may want to change the width setting).

Call InputBox() instead of gets().

You probably need windefs.h from the PCForm kit to get some of the definitions that aren't in pcheader.h.


Code: Select all


// This file is composed of bits from various PCForm source and header
// files.

#define   CONTROL_INPUT   230      // Base control ID for input box items
#define   CDLG_ITEMH   20      // Height of most items in box

int   gi_options ;         // User preferences

#define   OPT_M_IBSIP   0x1000      // Display popup keyboard when input box used

#define TRUE      1
#define FALSE      0

CreateInputDialogue() {

   int iHeight ;         // Height of whole input box
   int iWidth ;         // Width of whole input box
   int iLeft ;         // Left margin for box
   int iTop ;         // Top margin for box
   int iFlags ;         // Button creation flags
   
//   Fit the box into the centre of the screen

   iHeight = (CDLG_ITEMH * 3) + 37 ;
   iWidth = 220 ;
   iLeft = (screenx() - iWidth) / 2 ;
   
   switch (deviceplatform()) {
   case 2:                                       // PPC
      iTop = screeny() - 26 - 80 - iHeight - 10 ;
      iFlags = BS_DEFPUSHBUTTON ;
      break ;
   case 4:                                       // PocketPC
      iTop = screeny() - 26 - 26 - 80 - iHeight - 10 ;
      iFlags = BS_PUSHBUTTON ;
      break ;
   default:                                    // HPC, HPCPRO
      iTop = (screeny() - iHeight) / 2 ;
      iFlags = BS_DEFPUSHBUTTON ;
      break ;   
   }

//   Create the components of the box
   
   createctrl("EDIT", "Prompt string", WS_CHILD | ES_READONLY, 0,
               iLeft + 10   ,
               iTop + 10   ,
               iWidth - 20   ,
               CDLG_ITEMH   ,
               CONTROL_INPUT ) ;

   createctrl("EDIT", "User input box", WS_CHILD | WS_TABSTOP | ES_AUTOHSCROLL | ES_MULTILINE,
               WS_EX_CLIENTEDGE,
               iLeft + 10   ,
               iTop + 15 + CDLG_ITEMH   ,
               iWidth - 20   ,
               CDLG_ITEMH + 2   ,
               CONTROL_INPUT + 1) ;

   createctrl("BUTTON", "OK", iFlags | WS_CHILD | WS_TABSTOP, 0x0,
               iLeft + ((iWidth-(55+55+10))/2),
               iTop + (CDLG_ITEMH * 2) + 27,
               55,
               CDLG_ITEMH,
               CONTROL_INPUT + 2) ;
               
   createctrl("BUTTON", "Cancel", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0x0,
               iLeft + ((iWidth-(55+55+10))/2) + (55+10),
               iTop + (CDLG_ITEMH * 2) + 27,
               55,
               CDLG_ITEMH,
               CONTROL_INPUT + 3) ;

   createctrl("STATIC", "", WS_CHILD | WS_BORDER, WS_EX_WINDOWEDGE,
               iLeft, iTop, iWidth, iHeight, CONTROL_INPUT + 4) ;

}

//+
// InputBox   Display a user input box with a prompt and default
//
// Parameters:
//
//   string t_caption   Prompt to display in window caption
//   string t_default   Default value to place in input box
//
// Returns:
//
//   string         Data entered by user
//
//-

InputBox(string t_caption, string t_default) {

   int i_event ;
   int i_active ;
   int i_guiid ;
   int i_char ;
   int i_entered ;
   string t_result ;

   editset(CONTROL_INPUT, t_caption) ;
   editset(CONTROL_INPUT+1, t_default) ;
   sendmsg(CONTROL_INPUT+1, EM_SETSEL, 0, -1) ;
   wndshow(CONTROL_INPUT+4, SW_SHOW) ;
   wndshow(CONTROL_INPUT+3, SW_SHOW) ;
   wndshow(CONTROL_INPUT+2, SW_SHOW) ;
   wndshow(CONTROL_INPUT+1, SW_SHOW) ;
   wndshow(CONTROL_INPUT, SW_SHOW) ;

   if (gi_options & OPT_M_IBSIP) {
      devicesip(1) ;
   }
   guisetfocus(CONTROL_INPUT+1) ;

//   Standard event loop. Continue until user terminates with ENTER or ESC or
//   the box is closed. Ensure other applications can run whilst waiting.

   i_active = TRUE ;
   i_entered = FALSE ;
   t_result = t_default ;

   flushevent() ;

   while (i_active) {
      sleep(0) ;
      i_event = event(1) ;

      if (i_event == PM_CHAR) {

         i_guiid = guigetfocus() ;

         if (i_guiid == CONTROL_INPUT + 1) {

            i_char = key() ;
            switch (i_char) {
            case 13:                     // Enter
               if (i_entered) {
                  t_result = editget(CONTROL_INPUT + 1) ;
               } else {
                  editset(CONTROL_INPUT + 1, t_default) ;
                  t_result = t_default ;
               }
               i_active = FALSE ;
               break ;
            case 27:                     // Esc
               i_active = FALSE ;
               break ;
            default:
               i_entered = TRUE ;
               break ;
            }
         }
      }
   }

//   Hide the controls and return the user input, or default input

   devicesip(0) ;

   wndshow(CONTROL_INPUT+3, SW_HIDE) ;
   wndshow(CONTROL_INPUT+2, SW_HIDE) ;
   wndshow(CONTROL_INPUT+1, SW_HIDE) ;
   wndshow(CONTROL_INPUT, SW_HIDE) ;
   wndshow(CONTROL_INPUT+4, SW_HIDE) ;

   return (t_result) ;
}




Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum

PostPosted: Tue Sep 09, 2003 6:48 pm
by Mockingbird
8) Hoping for some help... I've tried the code below and finally got it to run without errors except that no inputbox is displayed. I'm using a HP720.

Has anyone had any success with this, and if so would you mind clueing me in.

Thanks in advance.

Joe