Announcement

Collapse
No announcement yet.

Sdk Graphic Button

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

  • Sdk Graphic Button

    Is there an SDK graphic button that can be superclassed?

    Bob Mechler

  • #2
    There is no such thing as an "sdk button." A button control is a button control.

    Can you create button controls which display a graphic? Yes. (See style BS_BITMAP) (and of course, BS_OWNERDRAW).

    Can you create your own button class using superclass techiques? Yes. (I do this).

    Can you create controls which look like a button, act like a button and show a graphic - but are not button controls or even button-based? Yes.

    Does DDT offer its own specialized "graphic button" controls? Yes. (CONTROL ADD IMGBUTTON[X])

    Can you add your own specialized button control to a DDT dialog? Yes. (CONTROL ADD "classname"...)
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      %BS_BITMAP is what I needed. Thanks.

      Bob Mechler

      Comment


      • #4
        Check out Jose's XP Themed button:
        Paul Squires
        FireFly Visual Designer (for PowerBASIC Windows 10+)
        Version 3 now available.
        http://www.planetsquires.com

        Comment


        • #5
          Thanks Paul.

          Reading in a Dave Navarro post in Poffs about BS_BITMAP being a Win 95 thing only.

          Bob Mechler

          Comment


          • #6
            Missing uxtheme.inc or don't know where to find it after downloading the code from Jose's site.

            Bob Mechler

            Comment


            • #7
              Huh? I don't see any reference in the code to a "uxtheme.inc" include file. Do you mean the "uxtheme.dll" ?
              Paul Squires
              FireFly Visual Designer (for PowerBASIC Windows 10+)
              Version 3 now available.
              http://www.planetsquires.com

              Comment


              • #8
                It is one of the more that 700 files of my new include files:
                Forum: http://www.jose.it-berater.org/smfforum/index.php

                Comment


                • #9
                  This is ok for me now. Any comments or suggestions will be appreciated.

                  Resource file: lookfeel.rc
                  Code:
                  #define IDR_IMGFILE2    104
                  #define IDR_IMGINQ	    102
                  01_TNET ICON HWA.ICO
                  02_PROG_EN ICON GRNCHKMK.ICO
                  03_PROG_DIS ICON GRYCHKMK.ICO
                  04_LEFT_MENU ICON GRRARROW.ICO
                  05_RIGHT_MENU ICON BLRARROW.ICO
                  IDR_IMGFILE2  BITMAP DISCARDABLE "MTOOLBAR.BMP"
                  IDR_IMGINQ    BITMAP DISCARDABLE "FindInq.bmp"
                  larrow  BITMAP larrow.bmp
                  rarrow  BITMAP rarrow.bmp
                  dlarrow BITMAP dlarrow.bmp
                  drarrow BITMAP drarrow.bmp
                  harrow  BITMAP harrow.bmp
                  earrow  BITMAP earrow.bmp
                  Sample program code:
                  Code:
                  #PBFORMS CREATED V1.51
                  #COMPILE EXE
                  #DIM ALL
                  
                  '------------------------------------------------------------------------------
                  '   ** Includes **
                  '------------------------------------------------------------------------------
                  #PBFORMS BEGIN INCLUDES 
                  #RESOURCE "lookfeel.pbr"
                  #IF NOT %DEF(%WINAPI)
                  	#INCLUDE "WIN32API.INC"
                  #ENDIF
                  #PBFORMS END INCLUDES
                  '------------------------------------------------------------------------------
                  
                  '------------------------------------------------------------------------------
                  '   ** Constants **
                  '------------------------------------------------------------------------------
                  #PBFORMS BEGIN CONSTANTS 
                  %IDD_DIALOG1    =  101
                  %IBT_IMGBUTTON1 = 1001      
                  %IBT_IMGBUTTON2 = 1002
                  %IDR_IMGFILE1   =  102
                  #PBFORMS END CONSTANTS
                  '------------------------------------------------------------------------------
                  
                  '------------------------------------------------------------------------------
                  '   ** Declarations **
                  '------------------------------------------------------------------------------
                  DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
                  DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
                  #PBFORMS DECLARATIONS
                  '------------------------------------------------------------------------------
                  
                  '------------------------------------------------------------------------------
                  '   ** Main Application Entry Point **
                  '------------------------------------------------------------------------------
                  FUNCTION PBMAIN()
                  	ShowDIALOG1 %HWND_DESKTOP
                  END FUNCTION
                  '------------------------------------------------------------------------------
                  
                  '------------------------------------------------------------------------------
                  '   ** CallBacks **
                  '------------------------------------------------------------------------------
                  CALLBACK FUNCTION ShowDIALOG1Proc()
                  
                  	SELECT CASE AS LONG CBMSG
                  		CASE %WM_INITDIALOG
                  			' Initialization handler
                  
                  		CASE %WM_NCACTIVATE
                  			STATIC hWndSaveFocus AS DWORD
                  			IF ISFALSE CBWPARAM THEN
                  				' Save control focus
                  				hWndSaveFocus = GetFocus()
                  			ELSEIF hWndSaveFocus THEN
                  				' Restore control focus
                  				SetFocus(hWndSaveFocus)
                  				hWndSaveFocus = 0
                  			END IF 
                  	  
                  	  CASE %WM_DESTROY
                  
                  		CASE %WM_COMMAND
                  			' Process control notifications
                  			SELECT CASE AS LONG CBCTL
                  				CASE %IBT_IMGBUTTON1
                  					IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                  						MSGBOX "%IBT_IMGBUTTON1=" + FORMAT$(%IBT_IMGBUTTON1), _
                  							%MB_TASKMODAL
                  					END IF 
                  				CASE %IBT_IMGBUTTON2
                  				  IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN  
                  				    MSGBOX "%IBT_IMGBUTTON2=" + FORMAT$(%IBT_IMGBUTTON2),%MB_TASKMODAL
                  				  END IF	
                  
                  			END SELECT
                  	END SELECT
                  END FUNCTION
                  '------------------------------------------------------------------------------
                  
                  '------------------------------------------------------------------------------
                  '   ** Dialogs **
                  '------------------------------------------------------------------------------
                  FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
                  	LOCAL lRslt AS LONG
                  	LOCAL hDlg  AS DWORD
                    LOCAL sitebmp AS STRING
                    sitebmp$ = "#102"
                    LOCAL hbmp AS DWORD                                  
                    hbmp = LoadImage(GetModuleHandle(ByVal %NULL),"#102", %IMAGE_BITMAP, 0,0,0)
                  	DIALOG NEW hParent, "Dialog1", 70, 70, 201, 121, %WS_POPUP OR %WS_BORDER OR _
                  		%WS_DLGFRAME OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR _
                  		%DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
                  		%WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                  		%WS_EX_RIGHTSCROLLBAR, TO hDlg
                  	CONTROL ADD IMGBUTTON, hDlg, %IBT_IMGBUTTON1, "#" + FORMAT$(%IDR_IMGFILE1), _
                  		64, 40, 11, 11 
                    CONTROL ADD "Button",hDlg,%IBT_IMGBUTTON2,"",64,80,11,11,%WS_CHILD OR %WS_VISIBLE OR %BS_BITMAP OR %BS_NOTIFY ,%WS_EX_LEFT	
                    CONTROL SEND hDlg, %IBT_IMGBUTTON2, %BM_SETIMAGE, %IMAGE_BITMAP, hbmp
                  
                  	DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
                  	DeleteObject hbmp		
                  
                  	FUNCTION = lRslt
                  END FUNCTION
                  '------------------------------------------------------------------------------
                  Bob Mechler

                  Comment


                  • #10
                    Thanks,

                    Bob Mechler

                    Comment

                    Working...
                    X