Subj : Slider Problems
To   : All
From : Vitus Jensen
Date : Fri Oct 27 2000 06:27 pm

Hi!

I asked this question in 1996 in OS2.PROG.GER, got no answer and ran into it
this evening once again: what am I doing wrong with my slider?

There is a slider inside a dialog, the dialog was created via IBM's Dialog
Editor (see progress.dlg).  The Dialog Editor isn't able to define ticks or
scale texts.  So I'm doing it by hand (see drverify.cpp).
None of the calls fail but the result is ugly:

   0    20  40    60  80    10
   |    |    |    |    |    |
   xxxxxxxxxxxxxxxxxxxxxxxxxx

The problem is that the "100" is cut after the first zero.  Questions are: why
and how do I avoid this?  Answers?




==================<drverify.cpp>============================
{
   WinSendDlgItemMsg(hwndDlg, SL_PROGPERCENT,
       SLM_SETTICKSIZE, MPFROM2SHORT(SMA_SETALLTICKS,6), NULL);
   for( unsigned i = 0; i < 6; ++i )
   {
char str[8];

sprintf(str, "%u", i * 20);
       WinSendDlgItemMsg(hwndDlg, SL_PROGPERCENT,
          SLM_SETSCALETEXT, MPFROMSHORT(i),
          MPFROMP(str));
   }
}
======================<end>=================================




=================<process.dlg>==============================
#ifndef OS2_INCLUDED
  #include <os2.h>
#endif
DLGINCLUDE 2 "resources.h"

DLGTEMPLATE IDW_PROGRESS LOADONCALL MOVEABLE DISCARDABLE
BEGIN
   DIALOG  "Array Verification", IDW_PROGRESS, 68, 75, 207, 79, WS_VISIBLE,
           FCF_SYSMENU | FCF_TITLEBAR
   BEGIN
       SLIDER          SL_PROGPERCENT, 9, 34, 187, 24, SLS_LEFT |
                       SLS_READONLY | SLS_RIBBONSTRIP | WS_GROUP | NOT
                       WS_TABSTOP
                       CTLDATA 12, 0, 6, 0, 0, 0
       PUSHBUTTON      "~Pause", PB_PAUSERESUME, 9, 8, 40, 14
       PUSHBUTTON      "~Abort", DID_CANCEL, 64, 8, 40, 14
       LTEXT           "Percentage done", -1, 60, 61, 84, 8
   END
END
======================<end>=================================


Bye,
  Vitus

---
* Origin: I'm not a Windows user, but I play one on TV. (2:2474/424.1)