Announcement

Collapse
No announcement yet.

PB9 and common controls

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

  • PB9 and common controls

    I understand that PB9 introduced some new functions for handling some common controls (Listview, Tab, Statusbar, etc.).

    If we use them, do we still need to call InitCommonControlsEx, or is PB handling that behind the scenes? If PB is handling it, is it initializing all common controls or just the ones that are being used with PB functions?

    If I want to use the DateTimepicker, for instance, does it matter if I set %NOLISTVIEW = 1 before including CommCtrl.INC?
    Bernard Ertl
    InterPlan Systems

  • #2
    Originally posted by Bern Ertl View Post
    If we use them, do we still need to call InitCommonControlsEx, or is PB handling that behind the scenes?
    Code:
    ' Note this compiles clean in PB9 without any includes
    #compile exe
    #dim all
    
    callback function CBHD
    end function
    '-------------------------------
    callback function CBLV
    end function
    '-------------------------------
    function pbmain () as long
        local hD as dword
    
        dialog new pixels, 0, "", 200, 200, 200, 200, %ws_sysmenu or %ws_caption, to hD
        control add listview, hD, 100, "", 50, 50, 100, 100, call CBLV
        dialog show modal hD call CBHD
    end function

    Comment


    • #3
      I read Bern's comment as asking about "custom controls", rather than the 22 common controls that PB Help discusses specifically. I saw in my own code that using InitCommonControlsEx wasn't necessary (for the group of 22), but wondered whether a custom control did require extra code, where a custom control is:

      A registered custom control or common control class name, for example, "MSCTLS_STATUSBAR32", ...
      I hadn't gotten to the point yet in PB of using anything other than the 22 controls covered by Help, but his message made me go ahead and take a look.

      It would appear that I have to drop over to MSDN (or this forum) for more details on the other common controls such as the datetime picker. But in addition to that, are there any other PB-specific requirements for using a "custom control"? It doesn't appear so, since as far as I can see the Help topic for custom controls is pretty much like that of any other control.

      So, I'd guess that all of the PowerBASIC CONTROL statements will work on a custom control as well (to the extent that they apply)? I guess I'll go experiment a bit and see.
      Last edited by Gary Beene; 5 Feb 2009, 02:04 PM.

      Comment


      • #4
        1. Write this program...
        Code:
        FUNCTION PBMAIN() AS LONG
           FUNCTION = 1
        END FUNCTION
        ... and compile.

        2. Download and compile this program: (the second one with the nicer interface):
        Show exports and imports for PB/Win 6x, 7x (original by Torsten Reinow)

        3. Using the import-export view program compiled in step 2, "OPEN" the EXE you compiled in step one.

        The "imports" shows you all the external functions used by your program. Print the list if you'd like.

        I think you will find the compiler has to work pretty hard just to create the above 'nothing' program, which actually calls a whole bunch of Windows functions.

        Of relevance, I believe it has been stated on multiple occasions here that InitCommonControlsEx is always called by PB-Compiled programs, although we do not know with which options (which controls are initialized).

        However, it is ALWAYS safe to call it yourself with the options for the controls you know you will be using: if that control is not yet initialized, it will be; and if it is, the function does nothing.


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

        Comment


        • #5
          Originally posted by Michael Mattias View Post
          However, it is ALWAYS safe to call it yourself with the options for the controls you know you will be using: if that control is not yet initialized, it will be; and if it is, the function does nothing.
          I suppose that's the bottom line.

          I was confused earlier that setting one of the %NO... equates for the CommCtrl.INC might muck something up. I realize now that it just excludes some equates, macros and function definitions.

          My stack overflowed...
          Bernard Ertl
          InterPlan Systems

          Comment

          Working...
          X