Announcement

Collapse
No announcement yet.

Trackbar SELection problem

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

  • Barry Erick
    replied
    On problem remains in the program I needed this in. After another routine in called, it acts line the control no longer has %TBS_ENABLESELRANGE is being turned off. So far, I have not found the problem. Maybe I can recall how to add that style or get the current styyle to see if it is there. I have buttons and updown controls areound this and it goes away when i apply a certain button.


    Updae: Found the problem. A wrong handle for another routine was killing it. (behind most problems is the programmer)
    Last edited by Barry Erick; 5 Feb 2009, 05:42 AM. Reason: update

    Leave a comment:


  • Barry Erick
    replied
    Thanks, That works. I added it to the sample tab contol (with a trackbar added) as this:

    Code:
       CASE %WM_INITDIALOG
                CONTROL HANDLE HTab1,%ID_TB1 TO ht
                DisableXPThemeControl ht

    Leave a comment:


  • Jules Marchildon
    replied
    I have updated the reference link posted above...

    Code:
    DECLARE FUNCTION SetWindowTheme(BYVAL hWnd AS DWORD, pszSubAppName AS ASCIIZ, pszSubIdList AS ASCIIZ) AS LONG   
     
    '------------------------------------------------------------------------------
    'Purpose: by calling SetWindowTheme with an empty string your control
    '         (button/checkbox/combo etc) will not be painted with the XP Theme.
    '
    'Example: LOCAL hButton AS DWORD
    '         hButton = GetDlgItem( CBHNDL, %IDOK )
    '         lRes = DisableXPThemeControl ( hbutton )
    '         InvalidateRect hButton,BYVAL %NULL,%TRUE
    '------------------------------------------------------------------------------
    FUNCTION DisableXPThemeControl(BYVAL hControl AS DWORD) AS LONG
      LOCAL hLib AS DWORD, pProc AS DWORD, lRes AS LONG
      hLib = LoadLibrary("UxTheme.dll")
      IF hLib THEN
         pProc = GetProcAddress(hLib, "SetWindowTheme")
         IF pProc THEN
            CALL DWORD pProc USING SetWindowTheme(hControl, " ", " ")  TO lRes
            FUNCTION = lRes
         END IF
         FreeLibrary hLib
      END IF
    END FUNCTION
    Last edited by Jules Marchildon; 2 Feb 2009, 06:16 PM. Reason: typo, & added Dave Biggs Declare -Thx.

    Leave a comment:


  • Dave Biggs
    replied
    Turn off "themed' visual style for individual control

    Ok I tried and it is possible..
    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "WIN32API.INC"
    #INCLUDE "COMMCTRL.INC"
    #RESOURCE "Theme.pbr"
     
    'Equates
    %BTN_Test      = 102
    %tb_Tracker    = 101
     
    'Globals
    GLOBAL hSlider, hFunc AS DWORD
     
    'Declarations
    DECLARE FUNCTION SetWindowTheme(BYVAL hWnd AS DWORD, pszSubAppName AS ASCIIZ, pszSubIdList AS ASCIIZ) AS LONG
    '------------------/
     
    CALLBACK FUNCTION DlgProc()
      SELECT CASE AS LONG CBMSG
        CASE %WM_INITDIALOG
          CALL DWORD hFunc USING SetWindowTheme(hSlider, " ", " ")
          SetProp hSlider, "Themed", %False
          SendMessage hSlider, %TBM_SETSEL ,%TRUE, MAKLNG(20,60)
     
        CASE %WM_COMMAND
          SELECT CASE AS LONG CBCTL
            CASE %BTN_Test
              IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                IF hFunc = 0 THEN EXIT FUNCTION         ' app not themed
                IF GetProp(hSlider, "Themed") = %True THEN
                  CALL DWORD hFunc USING SetWindowTheme(hSlider, " ", " ")   ' spaces
                  SetProp hSlider, "Themed", %False
                ELSE
                  CALL DWORD hFunc USING SetWindowTheme(hSlider, "", "")     ' nulls
                  SetProp hSlider, "Themed", %True
                END IF
                  DIALOG REDRAW CBHNDL
                SetWindowText CBHNDL, IIF$(GetProp (hSlider, "Themed"), "Slider Themed", "Not Themed")
              END IF
          END SELECT
     
        CASE %WM_SYSCOMMAND
          IF (CBWPARAM AND &HFFF0) = %SC_CLOSE THEN
            DIALOG END CBHNDL
          END IF
        CASE %WM_CLOSE
          RemoveProp hSlider, "Themed"
     
      END SELECT
    END FUNCTION
    '------------------/DlgProc
     
    FUNCTION PBMAIN()
     LOCAL hDlg  AS DWORD
     LOCAL hLib  AS DWORD
     LOCAL Res   AS LONG
     
     hLib = LoadLibrary("UxTheme.DLL")
      IF hLib THEN                                      ' xp machine
        hFunc = GetProcAddress(hLib, "SetWindowTheme")
      END IF
     
      DIALOG NEW 0, "Theme control test", , , 200, 120, %WS_CAPTION OR %WS_SYSMENU, TO hDlg
      CONTROL ADD BUTTON,  hDlg, %BTN_Test, "Test", 75, 60, 50, 15
      CONTROL ADD "msctls_trackbar32", hDlg, %tb_Tracker, "",10,25,167,14, _
                    %WS_CHILD OR %WS_VISIBLE OR %TBS_HORZ OR %TBS_BOTTOM OR _
                    %TBS_AUTOTICKS OR %TBS_ENABLESELRANGE OR %TBS_TOOLTIPS
      CONTROL HANDLE hDlg, %tb_Tracker TO hSlider
     
      DIALOG SHOW MODAL hDlg, CALL DlgProc
     FreeLibrary hLib
    END FUNCTION
    '------------------/PbMain
     
    #IF 0
    'Manifest file, save as "XPTheme.xml"
     
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly
      xmlns="urn:schemas-microsoft-com:asm.v1"
      manifestVersion="1.0">
    <assemblyIdentity
        NAME="CiaoSoftware.Ciao.Shell.Contacts"
        processorArchitecture="x86"
        version="5.1.0.0"
        TYPE="win32"/>
    <description>Windows SHELL</description>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                TYPE="win32"
                NAME="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="x86"
                publicKeyToken="6595b64144ccf1df"
                language="*"
            />
        </dependentAssembly>
    </dependency>
    </assembly>
    '.............................
     
    'Resource file, save as "Theme.pbr"
     
    //#INCLUDE "resource.h"
     
    //#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
    //#define RT_MANIFEST 24
     
    1   24    "XPTheme.xml"
    '.............................
     
    #ENDIF
    Last edited by Dave Biggs; 3 Feb 2009, 09:04 AM. Reason: 'FreeLibrary hLib' was missing before - Thx JM

    Leave a comment:


  • Dave Biggs
    replied
    Haven't tried it but apparently it is possible to turn off xp theme for individual controls...
    http://www.powerbasic.com/support/pb...ad.php?t=39401&

    Leave a comment:


  • Barry Erick
    replied
    Originally posted by Dave Biggs View Post
    Don't know if this helps but..

    As a test I added a trackbar to the parent dialog and another to one of the tab pages in the TabControl sample that comes with PBWin90.
    Both controls behaved the same in that neither showed the selected range highlighted when the dialog was 'Themed'.

    Once the manifest file was removed (commented out #RESOURCE "..." statement) both Trackbars showed the selected section highlighted!

    Confirmed this behaviour on a simple dialog with a single trackbar - again no highlight when dialog themed.
    Hmm. I do have a maifest file on the main program, but I just added this to the sample Tab and it was bad. Now I look at the source and I see it has the maifest file... Darn. Is it possible to use that file in some places and not others, or are we down to editing the xml source for the file?

    Leave a comment:


  • Dave Biggs
    replied
    Don't know if this helps but..

    As a test I added a trackbar to the parent dialog and another to one of the tab pages in the TabControl sample that comes with PBWin90.
    Both controls behaved the same in that neither showed the selected range highlighted when the dialog was 'Themed'.

    Once the manifest file was removed (commented out #RESOURCE "..." statement) both Trackbars showed the selected section highlighted!

    Confirmed this behaviour on a simple dialog with a single trackbar - again no highlight when dialog themed.
    Last edited by Dave Biggs; 1 Feb 2009, 08:58 AM.

    Leave a comment:


  • Barry Erick
    replied
    Originally posted by Jules Marchildon View Post
    I believe this is what you are after ?

    SendMessage hSlider, %TBM_SETSEL ,%TRUE, MAKLNG(20,60)

    http://msdn.microsoft.com/en-us/libr...49(VS.85).aspx
    I already have that code in. It works on a NON-TAB page, but not on a TAB page.

    Leave a comment:


  • Jules Marchildon
    replied
    I believe this is what you are after ?

    SendMessage hSlider, %TBM_SETSEL ,%TRUE, MAKLNG(20,60)

    http://msdn.microsoft.com/en-us/libr...49(VS.85).aspx

    Leave a comment:


  • Barry Erick
    started a topic Trackbar SELection problem

    Trackbar SELection problem

    I have a trackbar with the %TBS_ENABLESELRANGE in it which does show the select range carets or up arrows but it does NOT set the highlight color. Or, maybe the highlight color is the same as the the unselected area. It it possible to set this highlisht color. Everything I googled on shows "just use %TBS_ENABLESELRANGE to get the selection to work. That is not the problem. I do have the REDRAW paramter set, too. And GetSelSel shows the range is set.
    Has anyone seen this and/or know the answer?

    (A program test with just a Trackbar is fine in the selection area, so it is not my Windows highlight color.)

    The trackbar statement:
    Code:
        CONTROL ADD "msctls_trackbar32",hTab2, %tb_Tab2ProgressTracker,"",2,75,167,14, _
                    %WS_CHILD OR %WS_VISIBLE OR %TBS_HORZ OR %TBS_BOTTOM OR _
                    %TBS_AUTOTICKS OR %TBS_ENABLESELRANGE OR %TBS_TOOLTIPS
    This is on a Tab page. That is the only difference from one that works and this one.
    Last edited by Barry Erick; 31 Jan 2009, 03:19 PM.
Working...
X