• Slider Problems

    From Vitus Jensen@2:2474/424.1 to All on Fri Oct 27 18:27:54 2000
    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)
  • From Udo Zaydowicz@2:238/2001 to Vitus Jensen on Sat Oct 28 03:23:04 2000
    Hej Vitus!

    Vitus Jensen -> All, 28.10.2000: "Slider Problems"

    [...]
    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?

    Unfortunately the why is answered very easily: It's built in and can't be changed. Obviously the slider control does not leave enough room for text at the far left and far right positions.

    To avoid this, the PM Guide and Reference recommends the use of:

    - smaller font,
    - shorter text,
    - static control.




    Farvel, Udo!

    --- FleetStreet 1.22+
    * Origin: Wat mutt dat mutt (2:238/2001)
  • From MIKE RUSKAI@1:18/140 to VITUS JENSEN on Sat Oct 28 13:45:00 2000
    Some senseless babbling from Vitus Jensen to All
    on 10-28-00 01:27 about Slider Problems...

    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:
    [snip]

    It doesn't look like there's a workaround for this that doesn't involve
    doing some calculations and drawing separate controls above the slider to indicate the position's value.

    Mike Ruskai
    thannymeister@yahoo.com


    ... Conscience gets a lot of credit that belongs to cold feet.

    ___ Blue Wave/QWK v2.20
    --- Platinum Xpress/Win/WINServer v3.0pr5
    * Origin: Get all your fido mail here: www.docsplace.org (1:18/140)
  • From David Noon@2:257/609.5 to Vitus Jensen on Mon Oct 30 12:19:18 2000
    Hi Vitus,

    Replying to a message of Vitus Jensen to All:

    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

    Are "40" and "80" really justified differently from the others? Those 2 are right justified and the other tick values are left justified. Does the justification alternate from one tick mark to the next?

    Basically, what you want is the text to be right justified on all tick marks, or at least the last one. If the justification does alternate left and right, reducing the number of ticks by one might give you the desired result:

    0 25 50 75 100
    | | | | |
    +=====+=====+=====+=====+

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

    Another possible work-around would be to re-label the dialogue as "Percentage remaining" instead of "Percentage done", and have the ticks go from 100 down to
    0. This doesn't solve the underlying problem, but is possibly a quick kludge.

    Otherwise you are faced with what Udo has said: shorter text [unlikely], smaller font, or a static text control for your tick marks' text.

    Regards

    Dave
    <Team PL/I>

    --- FleetStreet 1.25.1
    * Origin: My other computer is an IBM S/390 (2:257/609.5)
  • From Vitus Jensen@2:2474/424.1 to Udo Zaydowicz on Tue Oct 31 18:29:18 2000
    Moin Udo!

    28.10.2000, Udo Zaydowicz wrote a message to Vitus Jensen:

    [...]
    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?

    Unfortunately the why is answered very easily: It's built in and can't
    be changed. Obviously the slider control does not leave enough room
    for text at the far left and far right positions.

    But doesn't this mean that the "tick text" feature of a slider is totally useless? IBM can't require that we stick to 1 or 2 character text!


    To avoid this, the PM Guide and Reference recommends the use of:

    - smaller font,
    - shorter text,
    - static control.

    "static control" is very urgly to handle (not worth the effort in my case), shorter text no option (how do you shorten 100? "C"?). Using a smaller font is
    a nice idea but IMHO one should stay in the same font family and with the today
    usage of "WarpSans.9" in dialogs there is no smaller WarpSans font.

    Idea: if you take a look at the setting notebook of c:\os2\apps\klondike.exe (options) you will notice that the slider has three ticks but the left one isn't located at the left margin. Probably the ticks are placed using SLM_ADDDETENT.
    I could create ticks at 10, 30, 50, 70 and 90 and avoid the problem...

    Bye,
    Vitus

    ---
    * Origin: Made in Germany! ... Ich wusste, da nagt einer! (2:2474/424.1)
  • From Udo Zaydowicz@2:238/2001 to Vitus Jensen on Wed Nov 1 09:04:36 2000
    Hej Vitus!

    Vitus Jensen -> Udo Zaydowicz, 01.11.2000: "Slider Problems"


    [...]
    But doesn't this mean that the "tick text" feature of a
    slider is totally useless? IBM can't require that we stick
    to 1 or 2 character text!

    I wouldn't say totally useless, but limited useable ;-)


    To avoid this, the PM Guide and Reference recommends the
    use of:
    [...]
    "static control" is very urgly to handle (not worth the
    effort in my case),

    Yes. But is it at all necessary to have the text?
    I assume, that you are using the slider only as a status bar !?


    shorter text no option (how do you shorten 100? "C"?).


    Doesn't look that good, but how about .1, .5, 1 or 1, 5, 10.


    Using a smaller font is a nice idea
    but IMHO one should stay in the same font family and with
    the today usage of "WarpSans.9" in dialogs there is no
    smaller WarpSans font.

    Definitely.


    Idea: if you take a look at the setting notebook of c:\os2\apps\klondike.exe (options) you will notice that the
    slider has three ticks but the left one isn't located at
    the left margin. Probably the ticks are placed using
    SLM_ADDDETENT.

    Possibly, unfortunately I don't have enough time to check it myself.

    Just an idea: Did you try, if at all possible, to strcat a few spaces (" ") to the "100", ending up with something like "100 ". Maybe it helps to shift the second 0 a bit to the left.


    Farvel, Udo!

    --- FleetStreet 1.22+
    * Origin: Wat mutt dat mutt (2:238/2001)
  • From Vitus Jensen@2:2474/424.1 to David Noon on Thu Nov 2 17:12:52 2000
    Moin David!

    30.10.2000, David Noon wrote a message to Vitus Jensen:

    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

    Are "40" and "80" really justified differently from the others? Those
    2 are right justified and the other tick values are left justified.
    Does the justification alternate from one tick mark to the next?

    No no. I just had problems doing the correct display in ASCII. All numbers are centered above their ticks.


    Basically, what you want is the text to be right justified on all tick marks, or at least the last one. If the justification does alternate
    left and right, reducing the number of ticks by one might give you
    the desired result:

    0 25 50 75 100
    | | | | |
    +=====+=====+=====+=====+


    How do you change the justification (on any text)? I searched the WinSetPresParam() documentation but there is no attribute "justification" listed.


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

    Another possible work-around would be to re-label the dialogue as "Percentage remaining" instead of "Percentage done", and have the
    ticks go from 100 down to 0. This doesn't solve the underlying
    problem, but is possibly a quick kludge.

    Otherwise you are faced with what Udo has said: shorter text
    [unlikely], smaller font, or a static text control for your tick
    marks' text.

    Just crude hacks...

    You could also place all ticks by hand (SLM_ADDDETENT) and make sure there is enough room for "100".

    Currently I'm using a different aproach:

    20 40 60 80
    | | | | | |
    +====+====+====+====+====+

    The user has to guess that the two empty ticks contain the values "0" and "100". <g>


    Bye,
    Vitus

    ---
    * Origin: Request VRAID - Software RAID for OS/2! (2:2474/424.1)
  • From Vitus Jensen@2:2474/424.1 to Udo Zaydowicz on Thu Nov 2 17:45:48 2000
    Moin Udo!

    01.11.2000, Udo Zaydowicz wrote a message to Vitus Jensen:

    ...
    To avoid this, the PM Guide and Reference recommends the
    use of:
    [...]
    "static control" is very urgly to handle (not worth the
    effort in my case),

    Yes. But is it at all necessary to have the text?
    I assume, that you are using the slider only as a status bar !?

    Yes, it's a status bar. But the process displayed could run some hours: it's the verification of an RAID >0 array. I'm testing with 200MB disks but users may try VRAID with some 40GB disks...

    When thinking about my specific use of a slider something like the windows solution would be nice: display the percentage value as a number inside the slider. Is there source code how to subclass a slider to build such a beast?

    ...
    Idea: if you take a look at the setting notebook of
    c:\os2\apps\klondike.exe (options) you will notice that the
    slider has three ticks but the left one isn't located at
    the left margin. Probably the ticks are placed using
    SLM_ADDDETENT.
    Possibly, unfortunately I don't have enough time to check it myself.

    Just an idea: Did you try, if at all possible, to strcat a few spaces
    (" ") to the "100", ending up with something like "100 ". Maybe it
    helps to shift the second 0 a bit to the left.

    Genius! That's it, I've added 3 spaces and the last zero is now located directly above the tick mark. Just like the value "0".


    Bye,
    Vitus

    ---
    * Origin: Win95: You make a grown man cry! (2:2474/424.1)
  • From Udo Zaydowicz@2:238/2001 to Vitus Jensen on Fri Nov 3 07:07:26 2000
    Hej Vitus!

    Vitus Jensen -> Udo Zaydowicz, 03.11.2000: "Slider Problems"


    [...]
    Yes, it's a status bar. But the process displayed could run
    some hours:

    Yes, then it's a better idea to have the text.


    [...]
    When thinking about my specific use of a slider something
    like the windows solution would be nice: display the
    percentage value as a number inside the slider. Is there
    source code how to subclass a slider to build such a beast?

    I don't know.
    In FleetStreet, there is a status bar with text (percentage) in a slider arm type 'thing'; try "Aufholen". Unfortunately, I don't know whether the status bar is realized as a slider.
    Maybe, you want to have a look at the source code, which is freely available probably in every BBS with OS/2 software.


    [...]
    Just an idea:
    [...]
    Genius!

    Ahh, only a 'blind chicken vs. grain' hit ;-)



    Farvel, Udo!

    --- FleetStreet 1.22+
    * Origin: Wat mutt dat mutt (2:238/2001)
  • From Vitus Jensen@2:2474/424.1 to Udo Zaydowicz on Thu Nov 9 17:55:44 2000
    Moin Udo!

    03.11.2000, Udo Zaydowicz wrote a message to Vitus Jensen:

    [...]
    Yes, it's a status bar. But the process displayed could run
    some hours:
    Yes, then it's a better idea to have the text.

    [...]
    When thinking about my specific use of a slider something
    like the windows solution would be nice: display the
    percentage value as a number inside the slider. Is there
    source code how to subclass a slider to build such a beast?

    I don't know.
    In FleetStreet, there is a status bar with text (percentage) in a
    slider arm type 'thing'; try "Aufholen".

    It's "aaterhaemta" in my swedish fleetstreet (well, nearly. Fleetstreet does not allow to use high ascii codes when the area is configured as ascii).

    Unfortunately, I don't know
    whether the status bar is realized as a slider. Maybe, you want to
    have a look at the source code, which is freely available probably in every BBS with OS/2 software.
    ...

    I did a search for SLM_ but got only hits for normal sliders not for the one with percentage values. There are 116 .c files so it will take some time to dig through...

    Bye,
    Vitus

    ---
    * Origin: OS/2: Your brain. Windows: Your brain on drugs. (2:2474/424.1)