Announcement

Collapse
No announcement yet.

PGBAR3D control for PB/DLL..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PGBAR3D control for PB/DLL..

    Hm, why so few custom controls for PB? So easy to do and at least for me,
    they save so much time in forthcoming projects. Anyway:

    Uploaded to http://www.tolken99.com/pb/pgbar3d.zip (size 22KB)

    Not a new one, but an update of previously posted code for a 3D progressbar
    control. Added palette in 256 color mode and changed a few messages to make
    it a bit easier to create and use. If your have been using older version, sorry,
    but only a few things need to be changed. Also trimmed code and changed a few
    mistakes with DC handling in previous version. Things gets better as we learn..

    Zip file contains PGBAR3D.INC include file and a demo, showing how to use the
    control. More info PGBAR3D.INC. All is Public Domain, with the usual disclaimers
    that goes with the concept (like if it works, I wrote it - if not, someone else did..


    ------------------

  • #2
    Just looked at my site logs. 82 downloads of above file in a few hours.
    PBcards package, now a total of 412 downloads. RRButton control, 261
    downloads in a few days. Obviously a big need for custom controls, so
    question stands - why don't more people do them?

    Advantage of custom controls: once done, instantly ready for use in next
    project. A few hours now and then on one can mean lots of saved time in
    the future and also give you the chance to add that little extra to your
    program. You know, the part that makes our PB programs stand out among
    all the industry-click&drag "programmed" VB/Delphi/VC++ stuff.

    There are many left to be done. Don't think we can have enough of buttons,
    labels, led controls, ownerdrawn lists of all sorts, editors, grid controls,
    statistical controls, whatever.

    I for one will keep on doing them. Have a bunch here I will clean up and post
    in a near future, but would be fun to see more, from other minds than my own,
    stricktly limited one too..

    BTW, the Pyramid card game I "un-oficially" told you about in PBcards thread
    has already been downloaded 346 times. Makes me feel there is a big market for
    PB games - at least in the PB community, but think the tiny download size we
    can produce can be a big hit outside these "walls". 60KB for a complete, zipped
    stand-alone card game? People will love it, I'm sure..


    ------------------

    Comment


    • #3
      Borje,

      I see your not getting much feedback, but I've looked
      at almost all your controls, and I really appreciate
      your postings, they've helped me a lot!!! Thank You, B

      ------------------

      Comment


      • #4
        Borje,

        Forget the feedback

        I'm also wondering, Borland has such great controls.
        All in VCL style, a simple wrapper and make it a DLL and every programming language could benefit.
        We know there are c programmers here but none has shown such a DLL yet.

        ??

        PS, i do have pretty much downloads on the controls i make even if it's an update (but no FB as you already know)
        Maybe people just don't neeed them, i think we make it to easy on them with these links.
        "Well ehh let's see then"

        And might be removed afterwards..
        Therefore hard to know if it's in use.



        ------------------
        hellobasic

        Comment


        • #5
          No worries, mate. Sharing code is always an un-grateful job, but when
          I look at my download stats, I see lots of people at least look at it.
          That's life. I have spoken before audiences of hundreds of people and
          when it's time for questions, usually only one or two shows interest,
          but the rest still listens eagerly..

          My motto is - if so only one person can benefit from what I do, it's worth
          doing (and what's worth doing, is always worth doing best way possible..)
          Glad to hear it can be of any use..


          ------------------

          Comment


          • #6
            Edwin - yes, some sort of VCL library would be nice to see in next version
            of PB. Maybe one even could start making some money on these little creatures
            then.. (he said, greedily drooling all over the keys..)

            Could always do DLL's of course, but unfortunately, I'm allergic to those, so..


            ------------------

            Comment


            • #7
              Obviously a big need for custom controls, so
              question stands - why don't more people do them?
              Like it or not, money drives the development of any product.

              Those who might develop custom controls obviously don't see an adequate market in the PB development community.

              Brand-M BASIC has what, 100,000 users? 200,000? 500,000? Biggest number I've seen PB acknowledge is "thousands."

              And in either case - brand M or brand P - only a small fraction of the total user count would even consider purchasing custom controls.

              Brand M comes with a lot of pointy-clicky-dragee-dropee-touchee-feelee stuff: easy to use, no need to buy.

              While PB does not come with a lot of this stuff, I'd like to think on balance that those who chose PB rather than brand M have little need for custom controls, 'cuz we are better programmers and can do it ourselves.

              (This is obviously not a scientific assessment).

              MCM


              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Borje, I think your controls are fantastic, as is your work ethic. Keep it up!!!



                ------------------
                Lance
                PowerBASIC Support
                mailto:[email protected][email protected]</A>
                Lance
                mailto:[email protected]

                Comment


                • #9
                  I will, as I'm sure the few others here who also do this will. Not
                  everything revolves around money in life. Some things gets done
                  because it's both fun and rewarding to do them, especially from a
                  learning point-of-view.

                  Most programming communities are filled with free samples and extras,
                  just like here. Difference is very few do it here, which is why I raise
                  the question - to challenge more to do it. In the end, we all benefit
                  from such approach, so..

                  Imagine 50 of us doing just one free custom control each, to be shared
                  by us all. Imagine how much time each of these controls can save us all,
                  at some point or another. Imagine how much more powerful this language
                  would be if that could happen.

                  Maybe PB inc. could start a competition - write the best free custom control
                  and win a million dollars.. (or a free upgrade to PB7, whatever is worth most..
                  Make it a million dollars, and I bet the PB language suddenly would be on
                  everyone's lips, all over the Internet. Imagine the sales that would emerge
                  from such a thing..


                  ------------------

                  Comment


                  • #10
                    Borje,

                    I have learnt this much with posting freeware, if it works well
                    you will hear almost nothing and get almost no feedback but if
                    there are any problems with it, you will get mail bombed. I guess
                    it says you mave many satisfied users, just keep up the good work.

                    Regards,

                    [email protected]

                    ------------------
                    hutch at movsd dot com
                    The MASM Forum

                    www.masm32.com

                    Comment


                    • #11
                      Borge,

                      Great work! You have doen a wonderful job. Apart from the Progress Bar, what other custom controls have you written?

                      Regards

                      Andrew

                      ------------------
                      --------------
                      mailto:[email protected][email protected]</A>
                      --------------
                      andrew dot lindsay at westnet dot com dot au

                      Comment


                      • #12
                        Börje,

                        Just downloaded POFFS2.0 and would like to say thank you for that
                        and other nice things you come up with. Oh, PBCODEC is valuable
                        tool.


                        Thank you.
                        Henning

                        btw For a while I've had a folder on my harddrive named:
                        C:\Download\Borje Hagsten

                        ------------------
                        Henning
                        Henning

                        Comment


                        • #13
                          Henning,

                          Nice coincidence! I have a directory called c:\pbtools\borje !!!


                          Borje,

                          I am amazed at the volume of contributions you make to the
                          PB community - and free at that! Amazing.

                          Keep up the fabulous work. I'll have to pick up the pace on the
                          PowerGUI product I'm writing. A nice designer to help use some of
                          your tools with



                          ------------------
                          Paul Squires
                          www.PlanetSquires.com
                          mailto:[email protected]
                          [email protected]
                          </A>
                          Paul Squires
                          FireFly Visual Designer (for PowerBASIC Windows 10+)
                          Version 3 now available.
                          http://www.planetsquires.com

                          Comment


                          • #14
                            Borje,

                            Whether you know it or not, you've inspired programmers (at least
                            this one) with some of your ideas and examples. When I saw your
                            progress bar in POFFS, I liked it so much I made one using EzGui.
                            In the proper spirit of things, I posted it on Chris Boss code
                            forum. Keep it up. I just hope someday to be able to return
                            the favor.

                            Russ Srole


                            ------------------
                            "There are two novels that can change a bookish fourteen-year old's life: The Lord of the Rings and Atlas Shrugged. One is a childish fantasy that often engenders a lifelong obsession with its unbelievable heroes, leading to an emotionally stunted, socially crippled adulthood, unable to deal with the real world. The other, of course, involves orcs." - John Rogers

                            Comment


                            • #15
                              Thanks for kind words, and at same time, thanks to whole PB community
                              for the generous spirit that floats around here. Must be something
                              in the air..

                              Andrew, hard to remember all. A Virtual List (updated by Jules), an edit
                              control, RRButton, PBcards, a bunch of ownerdrawn lists, etc. I'll try
                              to update/upload my PB webpage later on today.


                              ------------------

                              Comment


                              • #16
                                Borje;

                                Thanks for the update on this 3D progess control! I came across the same
                                problem as I did on the first release. The two vertical progress bars
                                come up short by about 2 pixels when filling up. I mentioned this to you
                                in a private email with a small screen capture. I am not sure if it is just
                                my machine, Win98SE/"LCD panel" 1024x768 HighColor(16 Bit) or others have
                                experienced this?

                                I simply changed this value in the demo program to correct it...
                                Code:
                                  CreatePGBar3D hDlg, %ID_BARLEFT, "", 5, 20, 14, 100, _ '<--was 98, changed(100) to fix gap
                                                %WS_CHILD OR %WS_VISIBLE, %WS_EX_CLIENTEDGE, 1                 'LEFT BAR, VERTICAL      
                                ...
                                                                                     
                                  CreatePGBar3D hDlg, %ID_BARRIGHT, "", 181, 20, 14, 100, _ '<--was 98, changed(100) to fix gap
                                                %WS_CHILD OR %WS_VISIBLE, %WS_EX_CLIENTEDGE, 1                  'RIGHT BAR, VERTICAL
                                Regards,
                                Jules
                                Best regards
                                Jules
                                www.rpmarchildon.com

                                Comment


                                • #17
                                  I think if there were a vote for the PB MVM (most valuable member)
                                  then there would be two that would be at the forefront..
                                  Semen & Borje. There help (along with Chris, Jules, Lance and
                                  many many more) makes PB users grow and makes PB itself grow.
                                  How about PB having an anual vote for the MVM and rewarding the
                                  winner as appropriate ?

                                  Just a thought...
                                  NJH.


                                  ------------------

                                  Comment


                                  • #18
                                    We thought of it, but decided everyone was a winner because you are all using PowerBASIC!

                                    ------------------
                                    Lance
                                    PowerBASIC Support
                                    mailto:[email protected][email protected]</A>
                                    Lance
                                    mailto:[email protected]

                                    Comment


                                    • #19
                                      Borje,

                                      I just got around to looking at the progress bar - Great work!
                                      I really like it and thx for the new Poffs. I use Poffs alot.

                                      I have a question about the progress bar,

                                      I need a progress bar that can change color, and leave a "trail"
                                      of the colors it has been.

                                      So for example if one process is red the next green and the final
                                      process Blue, the final progress bar would have some portion red
                                      then a section of green and finally blue up to the 100% mark.

                                      Can this progress bar do that somehow?

                                      ------------------
                                      Kind Regards
                                      Mike

                                      Comment


                                      • #20
                                        Thanks, and sorry - no, because it builds the whole bar first and then
                                        copies part of it as progress proceeds. Once saw something like you
                                        describe done another way - they had placed several shorter progressbars
                                        side by side, one for each process. Actually quite nice, because it gave
                                        you a better impression of speed when progress were slow.

                                        Otherwise one will have to do other way and decide colors as progress
                                        proceeds. Not that hard to do, but means one must use a slightly different
                                        approach, since the bars can't be "pre-made".

                                        To show one way - maybe not possible to use in this case, but still..
                                        Code:
                                        '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                                        ' Test program for custom control Progressbar include file, PGBAR3D.INC
                                        ' This one uses three bars side by side, to show process in three different colors..
                                        ''¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                                        #COMPILE EXE
                                        #INCLUDE "WIN32API.INC"
                                        #INCLUDE "PGBAR3D.INC"  '<- Progressbar include file
                                         
                                        %ID_BUTNSTART   = 101
                                        %ID_BUTNREVERSE = 102
                                        %ID_OPTFAST     = 120
                                        %ID_OPTSLOW     = 121
                                        %ID_BAR1        = 202
                                        %ID_BAR2        = 203
                                        %ID_BAR3        = 204
                                         
                                        '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                                        ' Main dialog callback procedure
                                        '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                                        CALLBACK FUNCTION DlgMainProc
                                          LOCAL I AS LONG, txt AS STRING
                                          STATIC slow AS LONG
                                         
                                          SELECT CASE CBMSG
                                             CASE %WM_COMMAND
                                                SELECT CASE CBCTL
                                                   CASE %ID_BUTNSTART
                                                      CONTROL GET CHECK CBHNDL, %ID_OPTSLOW TO slow   '<- check settings for slow/fast
                                                      CONTROL DISABLE CBHNDL, %ID_BUTNSTART      '<- disable start button
                                                      FOR I = 1 TO 100
                                                         IF I < 34 THEN
                                                            CONTROL SEND CBHNDL, %ID_BAR1, %PGB_STEPUP, 0, 0
                                                         ELSEIF I < 67 THEN
                                                            CONTROL SEND CBHNDL, %ID_BAR2, %PGB_STEPUP, 0, 0
                                                         ELSE
                                                            CONTROL SEND CBHNDL, %ID_BAR3, %PGB_STEPUP, 0, 0
                                                         END IF
                                                         txt = FORMAT$(I) + "%"
                                                         CONTROL SEND CBHNDL, %ID_BAR2, %PGB_SETTXTBKG, STRPTR(txt), 1
                                                         CONTROL SEND CBHNDL, %ID_BAR2, %PGB_SETTXTBAR, STRPTR(txt), 1
                                                         IF I MOD 2 = 0 THEN DIALOG DOEVENTS
                                                         IF slow THEN SLEEP 40                '<- if "slow" has been selected
                                                      NEXT
                                                      CONTROL ENABLE CBHNDL, %ID_BUTNREVERSE     '<- enable reverse button
                                         
                                                   CASE %ID_BUTNREVERSE
                                                      CONTROL DISABLE CBHNDL, %ID_BUTNREVERSE
                                                      FOR I = 99 TO 0 STEP - 1
                                                         IF I > 66 THEN
                                                            CONTROL SEND CBHNDL, %ID_BAR3, %PGB_STEPDN, 0, 0
                                                         ELSEIF I > 33 THEN
                                                            CONTROL SEND CBHNDL, %ID_BAR2, %PGB_STEPDN, 0, 0
                                                         ELSE
                                                            CONTROL SEND CBHNDL, %ID_BAR1, %PGB_STEPDN, 0, 0
                                                         END IF
                                                         txt = FORMAT$(I) + "%"
                                                         CONTROL SEND CBHNDL, %ID_BAR2, %PGB_SETTXTBKG, STRPTR(txt), 1
                                                         CONTROL SEND CBHNDL, %ID_BAR2, %PGB_SETTXTBAR, STRPTR(txt), 1
                                                         IF I MOD 2 = 0 THEN DIALOG DOEVENTS
                                                         IF slow THEN SLEEP 40   'if "slow" has been selected
                                                      NEXT
                                                      CONTROL ENABLE CBHNDL, %ID_BUTNSTART
                                         
                                                   CASE %ID_OPTSLOW, %ID_OPTFAST
                                                      CONTROL GET CHECK CBHNDL, %ID_OPTSLOW TO slow  '<- set slow/fast mode
                                         
                                                END SELECT
                                         
                                             CASE %WM_PALETTECHANGED
                                                'if in 256 color mode, switching between app's with different palettes
                                                'can cause weird results. Trapping %WM_PALETTECHANGED and redrawing
                                                'entire dialog helps some. Maybe not the best solution, but..
                                                IF CBWPARAM <> CBHNDL THEN
                                                   RedrawWindow CBHNDL, ByVal 0, ByVal 0, %RDW_INVALIDATE OR %RDW_UPDATENOW
                                                END IF
                                         
                                          END SELECT
                                        END FUNCTION
                                         
                                        '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                                        ' Start point - build dialog, controls and set some initial data
                                        '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                                        FUNCTION PBMAIN () AS LONG
                                          LOCAL hDlg AS LONG
                                          DIALOG NEW 0, "PGBAR3D trippel-bar demo", ,, 190, 70, %WS_CAPTION OR %WS_SYSMENU TO hDlg
                                         
                                          CONTROL ADD BUTTON,   hDlg, %ID_BUTNSTART,   "Start",      100, 52, 75, 14
                                          CONTROL ADD BUTTON,   hDlg, %ID_BUTNREVERSE, "Reverse",     25, 52, 75, 14
                                          CONTROL ADD OPTION,   hDlg, %ID_OPTFAST,     "Fast",        30, 28, 40, 10
                                          CONTROL ADD OPTION,   hDlg, %ID_OPTSLOW,     "Slow",        30, 38, 40, 10
                                          CONTROL SET CHECK     hDlg, %ID_OPTFAST, 1
                                          CONTROL DISABLE hDlg, %ID_BUTNREVERSE
                                         
                                          CONTROL ADD LABEL, hDlg, -1, "", 5, 5, 180, 14, 0, %WS_EX_CLIENTEDGE
                                         
                                          CreatePGBar3D hDlg, %ID_BAR1, "", 6, 6, 59, 12, _
                                                        %WS_CHILD OR %WS_VISIBLE, 0, 1                                  'BAR1
                                                CONTROL SEND hDlg, %ID_BAR1, %PGB_SETMAX, 33, 0                         'max number of steps
                                                CONTROL SEND hDlg, %ID_BAR1, %PGB_SETBARCOL, %PGB_RED, 0                'bar color scheme
                                                CONTROL SEND hDlg, %ID_BAR1, %PGB_SETCOLBKG, GetSysColor(%COLOR_3DFACE), 0 'background color
                                         
                                          CreatePGBar3D hDlg, %ID_BAR2, "", 65, 6, 59, 12, _
                                                        %WS_CHILD OR %WS_VISIBLE, 0, 1                                  'BAR2
                                                CONTROL SEND hDlg, %ID_BAR2, %PGB_SETMAX, 33, 0                         'max number of steps
                                                CONTROL SEND hDlg, %ID_BAR2, %PGB_SETBARCOL, %PGB_BLUE, 0               'bar color scheme
                                                CONTROL SEND hDlg, %ID_BAR2, %PGB_SETTXTON, 0, 2                        'show own text
                                                CONTROL SEND hDlg, %ID_BAR2, %PGB_SETTXTCOLBKG, RGB(0,0,128), 0         'backgound text color
                                                CONTROL SEND hDlg, %ID_BAR2, %PGB_SETTXTCOLBAR, RGB(255,255,0), 0       'bar text color
                                                CONTROL SEND hDlg, %ID_BAR2, %PGB_SETCOLBKG, GetSysColor(%COLOR_3DFACE), 0 'background color
                                         
                                          CreatePGBar3D hDlg, %ID_BAR3, "", 124, 6, 60, 12, _
                                                        %WS_CHILD OR %WS_VISIBLE, 0, 1                                   'BAR3
                                                CONTROL SEND hDlg, %ID_BAR3, %PGB_SETMAX, 33, 0                          'max number of steps
                                                CONTROL SEND hDlg, %ID_BAR3, %PGB_SETBARCOL, %PGB_GREEN, 0               'bar color scheme
                                                CONTROL SEND hDlg, %ID_BAR3, %PGB_SETCOLBKG, GetSysColor(%COLOR_3DFACE), 0 'background color
                                         
                                          CONTROL SEND hDlg, %ID_BAR1, %PGB_BUILDBARS, 0, 0   'finally, build the bars - IMPORTANT!
                                          CONTROL SEND hDlg, %ID_BAR2, %PGB_BUILDBARS, 0, 0
                                          CONTROL SEND hDlg, %ID_BAR3, %PGB_BUILDBARS, 0, 0
                                         
                                          DIALOG SHOW MODAL hDlg, CALL DlgMainProc
                                        END FUNCTION

                                        ------------------

                                        Comment

                                        Working...
                                        X