Page 1 of 1

Visual Style Buttons

Posted: Mon Apr 13, 2015 7:46 pm
by rdonnay
DCPUSHBUTTONXP will now paint the background of the button in the Windows visual style if the ::bgColor is GRA_CLR_BACKGROUND and a manifest file is used. This was added in build 261.

Unzip the attached file into your ..\samples\buttonxp folder.
Then run Pbuild VisualStyle.xpj to build VisualStyle.exe.
visualstyle.jpg
visualstyle.jpg (36.97 KiB) Viewed 7783 times

Code: Select all

#INCLUDE "dcdialog.CH"
#include "gra.ch"

#define COLOR_LTORANGE   GraMakeRGBColor( { 250, 205,   0 } )

FUNCTION Main()

LOCAL GetList[0], aCaptions, bMenuAction, oMenu, oBigButton

DC_BitMapTransparentColor(GraMakeRGBColor({192,192,192}))

bMenuAction := {|a,b,o|oMenu:PopUp( o:setParent(), o:currentPos(), 2 , ;
                                    XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN  ) }

DCSUBMENU oMenu PROMPT 'Menu' OWNERDRAW

  DCMENUITEM 'Disable the Really Big Bug' PARENT oMenu ;
    ACTION {||oBigButton:disable()}  WHEN {||oBigButton:isEnabled()}

  DCMENUITEM 'Enable the Really Big Bug' PARENT oMenu ;
    ACTION {||oBigButton:enable()}  WHEN {||!oBigButton:isEnabled()}

@ 0,0 DCPUSHBUTTON CAPTION 'Last Record' SIZE 20,3 ;
                   BITMAP 'GotoLast_Enable.ico' OFFSET 10 ;
                   COLOR GRA_CLR_BLACK,GRA_CLR_BACKGROUND

@ 4,0 DCPUSHBUTTONXP ;
   CAPTION 'This is a Button;with a lot of text.;It will word-wrap;very nicely;thank you!' ;
   SIZE 35,7 ;
   COLOR GRA_CLR_BLACK,GRA_CLR_BACKGROUND ;
   BITMAP '..\..\bitmaps\bugicon.bmp' OFFSET 15 ;
   FONT '12.Arial Bold' ;
   SOUND {DC_CurPath() + '\IR_END.WAV'}

aCaptions := { ;
  { DC_GetBitMap('..\..\bitmaps\bugicon.bmp'),, 20,10,120,100,,,}, ;
  { 'This is a', GRA_CLR_BLACK, 50, 120,,,,'24.Lucida Console',,}, ;
  { 'Really Big', GRA_CLR_RED,   140, 120,,,,'32.Arial Bold',,}, ;
  { 'Bug', COLOR_LTORANGE,  230, 120,,,,'32.Helv Bold',,} }

@ 12, 0 DCPUSHBUTTONXP ;
   SIZE 50,7 ;
   CAPTIONARRAY aCaptions ;
   MENUACTION bMenuAction ;
   ACTION {||DC_MsgBox({'I am Really Big!!','Click my down arrow for my menu'})} ;
   OBJECT oBigButton ;
   COLOR GRA_CLR_DARKGREEN, GRA_CLR_BACKGROUND ;
   SOUND { DC_CurPath()+'\ding.wav' } ;

DCREAD GUI FIT TITLE 'Visual Style Buttons'

RETURN nil

PROC appsys ; RETURN

Re: Visual Style Buttons

Posted: Tue Apr 14, 2015 2:35 pm
by Auge_Ohr
hi,

i saw in your Manifest File

Code: Select all

</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
	<security>
	  <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"/>
      </requestedPrivileges>
	</security>
</trustInfo>
did you have a link to get more Information what that Code is for ?

Re: Visual Style Buttons

Posted: Sat Apr 18, 2015 2:53 am
by jdsoft
Hello,

The link below explains exactly the manifest file.

https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Regards,
Jack Duijf

Re: Visual Style Buttons

Posted: Sat Apr 18, 2015 10:14 am
by Auge_Ohr
hi,
jdsoft wrote:The link below explains exactly the manifest file.
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
thx for the link.
i do knew Manifest but my Question was about that Code-Snip when using "false" :shock:

"requestedExecutionLevel" have Level :

1.) asInvoker
2.) highestAvailable
3.) requireAdministrator

but it make no Sence to me to use "false" for a Level ?