Alaska Software Inc. - XbpPushButton()
Username: Password:
AuthorTopic: XbpPushButton()
Carlos a Beling XbpPushButton()
on Tue, 19 Jun 2018 18:04:37 -0300
Hello Good night.
I wrote a owner draw subclass from XbpPushButton() and I coded:

METHOD CabPushButton_:init()
... program code
       ::drawMode := XBP_DRAW_OWNER   XBP_DRAW_OWNERADVANCED
RETURN Super:init()

METHOD CabPushButton_:create(oParent, oOwner,        aPos,        aSize, 
          aAppPush,      lVisible)
... program code
	Super:create(oParent, oOwner, aPos, aSize,;
                       {{XBP_PP_BGCLR,          ::nColorBG},;
                        {XBP_PP_FGCLR,          ::nColorFG},;
                        {XBP_PP_DISABLED_BGCLR, ::nColorBGDisable},;
                        {XBP_PP_FONT,           ::oFont}},;
                        lVisible)
... program code
        if lIsEnable  <> NIL .and.;
           !lIsEnable
           ::disable()
        else
           ::enable()
        endif
RETURN Self

INLINE METHOD draw(oPS, aInfo)
... program code
using Gra...()
RETURN .f.

Event loop:
nEvent := AppEvent(@mp1, @mp2, @oXbp)
do while .t.
    if (nEvent == xbeK_ESC            .or.;
        nEvent == xbeP_Close          .or.;
       (nEvent == xbeP_Keyboard .and.;
        mp1    == xbeK_ESC))
       exit
       endif
    endif
    oXbp:handleEvent(nEvent, mp1,mp2)
    nEvent := AppEvent(@mp1, @mp2, @oXbp)
enddo


And the method ::draw() is not executed. Please why it does not work?

Fraternally
Beling
Jim LeeRe: XbpPushButton()
on Wed, 20 Jun 2018 16:33:56 +0200
hi,

o:Draw is a Callback Slot not a Method

> METHOD CabPushButton_:init()
> ... program code
>       ::drawMode := XBP_DRAW_OWNER   XBP_DRAW_OWNERADVANCED
 missing line
         :::draw      := {| oPS, aInfo, oSelf | ::MyDraw(oPS, aInfo)  }

> RETURN Super:init()

 use other Name for Metthod
> INLINE METHOD MyDraw(oPS, aInfo)
> ... program code
> using Gra...()
> RETURN .f.

do you want to write that in every Event loop ?

> Event loop:
> nEvent := AppEvent(@mp1, @mp2, @oXbp)
> do while .t.
>    if (nEvent == xbeK_ESC            .or.;
>        nEvent == xbeP_Close          .or.;
>       (nEvent == xbeP_Keyboard .and.;
>        mp1    == xbeK_ESC))
>       exit
>       endif
>    endif
>    oXbp:handleEvent(nEvent, mp1,mp2)
>    nEvent := AppEvent(@mp1, @mp2, @oXbp)
> enddo

   bKeyBoard := { | nKey, mp2, obj | KeyHandler( nKey, obj ) }
   ::keyboard := bKeyboard

PROCEDURE KeyHandler( nKey, oButton )
   DO CASE
      CASE nKey == xbeK_ESC
         PostAppEvent( xbeP_Close,,, oButton:setParent() :setParent() )
      CASE nKey == xbeK_RETURN
         PostAppEvent( xbeP_Activate,,, oButton )
      CASE nKey == xbeK_SPACE
         PostAppEvent( xbeP_Activate,,, oButton )
Carlos a Beling Re: XbpPushButton()
on Wed, 20 Jun 2018 11:54:14 -0300
Hello Jim.
Good morning.
Many thanks.
I will give it a try.

Another question:
Why ::setPointer(NIL, cabPTR_UNAVAIABLE) does not work?
a) cabPRT_UNAIVABLE is a numeric resource created with a .CUR file and 
is in a Dll built by ARC.exe
b) this Dll is linked to the exe.
c) even making ::setPointer('MyDll.dll', cabPTR_UNAVAIABLE) does not work.

Fraternally
Beling

Em 20/06/2018 11:33, Jim Lee escreveu:
> hi,
>
> o:Draw is a Callback Slot not a Method
>
>> METHOD CabPushButton_:init()
>> ... program code
>>        ::drawMode := XBP_DRAW_OWNER   XBP_DRAW_OWNERADVANCED
>  missing line
>           :::draw      := {| oPS, aInfo, oSelf | ::MyDraw(oPS, aInfo)  }
>
>> RETURN Super:init()
>
>  use other Name for Metthod
>> INLINE METHOD MyDraw(oPS, aInfo)
>> ... program code
>> using Gra...()
>> RETURN .f.
>
> do you want to write that in every Event loop ?
>
>> Event loop:
>> nEvent := AppEvent(@mp1, @mp2, @oXbp)
>> do while .t.
>>     if (nEvent == xbeK_ESC            .or.;
>>         nEvent == xbeP_Close          .or.;
>>        (nEvent == xbeP_Keyboard .and.;
>>         mp1    == xbeK_ESC))
>>        exit
>>        endif
>>     endif
>>     oXbp:handleEvent(nEvent, mp1,mp2)
>>     nEvent := AppEvent(@mp1, @mp2, @oXbp)
>> enddo
>
>     bKeyBoard := { | nKey, mp2, obj | KeyHandler( nKey, obj ) }
>     ::keyboard := bKeyboard
>
> PROCEDURE KeyHandler( nKey, oButton )
>     DO CASE
>        CASE nKey == xbeK_ESC
>           PostAppEvent( xbeP_Close,,, oButton:setParent() :setParent() )
>        CASE nKey == xbeK_RETURN
>           PostAppEvent( xbeP_Activate,,, oButton )
>        CASE nKey == xbeK_SPACE
>           PostAppEvent( xbeP_Activate,,, oButton )
>
>
Jim LeeRe: XbpPushButton()
on Wed, 20 Jun 2018 18:55:32 +0200
> Why ::setPointer(NIL, cabPTR_UNAVAIABLE) does not work?
> a) cabPRT_UNAIVABLE is a numeric resource created with a .CUR file and is 
> in a Dll built by ARC.exe

how does your *.ARC look like ?

POINTER
     6000       = ".\..\RES\blank.cur"
     6001       = ".\..\RES\DRAG.CUR"
     6002       = ".\..\RES\NODROP.CUR"
Carlos a Beling Re: XbpPushButton()
on Wed, 20 Jun 2018 15:11:48 -0300
Hello Jim.
Good afternoon.
Many thanks again

Here are the ARC file lines:
POINTER
   cabPTR_UNAVAIABLE  = FILE 'C:\MSI\Gui\Resource\Source\Unavailable.cur'

The file Unavailable.cur is attached.

The resource exists in the EXE as the attach Inside.png

Fraternally
Beling


Em 20/06/2018 13:55, Jim Lee escreveu:
>> Why ::setPointer(NIL, cabPTR_UNAVAIABLE) does not work?
>> a) cabPRT_UNAIVABLE is a numeric resource created with a .CUR file and is
>> in a Dll built by ARC.exe
>
> how does your *.ARC look like ?
>
> POINTER
>       6000       = ".\..\RES\blank.cur"
>       6001       = ".\..\RES\DRAG.CUR"
>       6002       = ".\..\RES\NODROP.CUR"
>
>


Unavailable.cur
Inside.png
Jim LeeRe: XbpPushButton()
on Thu, 21 Jun 2018 01:33:12 +0200
> POINTER
>   cabPTR_UNAVAIABLE  = FILE 'C:\MSI\Gui\Resource\Source\Unavailable.cur'

there is no FILE in Syntax
see \Source\samples\basics\Resource\ResDemo.arc
Paul ChongRe: XbpPushButton()
on Thu, 21 Jun 2018 12:39:01 +0800
From the doc, FILE is used in a named resource identifier

   USERDEF JPEG 
      MYIMAGE = FILE "cool.jpeg" 

On Thu, 21 Jun 2018 01:33:12 +0200, Jim Lee wrote:

>> POINTER
>>   cabPTR_UNAVAIABLE  = FILE 'C:\MSI\Gui\Resource\Source\Unavailable.cur'
> 
> there is no FILE in Syntax
> see \Source\samples\basics\Resource\ResDemo.arc
Jim LeeRe: XbpPushButton()
on Thu, 21 Jun 2018 07:53:23 +0200
> From the doc, FILE is used in a named resource identifier
>
>   USERDEF JPEG
>      MYIMAGE = FILE "cool.jpeg"

but this is NOT for POINTER see \SOURCE\samples\basics\Resource\ResDemo.arc

POINTER
#ifdef __OS2__
        RD_CROSS  = "BCROSS.PTR"
        RD_BEAM   = "ABEAM.PTR"
        RD_NODROP = "NODROP.PTR"
        RD_ARROW  = "FIREW.PTR"
        RD_MOVE   = "XMAS.PTR"
#endif
#ifdef __WIN32__
        RD_CROSS  = "BCROSS.CUR"
        RD_BEAM   = "ABEAM.CUR"
        RD_NODROP = "NODROP.CUR"
        RD_ARROW  = "FIREW.CUR"
        RD_MOVE   = "XMAS.CUR"
#endif

ICON
        RD_XPP    = "Xpp.ico"
        RD_FLD    = "XppFld.ico"
        RD_XPPFD  = "XppBook.ico"
        RD_XFF    = "XppXff.ico"
        RD_PBUILD = "Pbuild.ico"

BITMAP
        RD_BMP1   = FILE "Tile3.bmp"
        RD_BMP2   = FILE "Tile5.bmp"
        RD_BMP3   = FILE "Tile7.bmp"
        RD_BMP4   = FILE "Tile9.bmp"
        RD_BMP5   = FILE "Tile10.bmp"

USERDEF JPEG
        TILE1     = FILE "Tile1.jpg"
Andreas Gehrs-Pahl
Re: XbpPushButton()
on Thu, 21 Jun 2018 06:41:27 -0400
I don't think this is the issue.

>>From the doc, FILE is used in a named resource identifier
>but this is NOT for POINTER see \SOURCE\samples\basics\Resource\ResDemo.arc

Quoted from the documentation:

|The value part of the declaration can either be a string literal, or a FILE 
|statement. ICON, BITMAP and POINTER values are treated as file names by 
|default, there is no difference when using FILE on these resource types. 

So, the FILE statement (for Pointer Resources) is optional (and redundant), 
but shouldn't make a difference in this case.

As always, a working (or better, failing) example would make much more sense 
here. The problem description(s) are vague and inconsistent (talking about a 
DLL and/or an EXE, with inconsistent file names in the text, attachment, and 
the unexplained image).

In my experience, going through the effort of creating an example program to 
be posted here will have one of two outcomes: either the problem reveals 
itself by creating the demo/test program -- and no post is necessary -- or 
the program makes it possible for other newsgroup readers to reproduce the 
issue and probably provide a solution for the problem.

Either way, it is much more productive than a lot of posts with random 
suggestions that usually lead to nothing concrete.

Just my 2 cents.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Carlos a Beling Re: XbpPushButton()
on Fri, 22 Jun 2018 18:19:38 -0300
Hello Andreas.
Good evening.
Again many thanks.
I read in the docs that xbpPushbutton() disabled does not receive mouse 
events, and I was trying to change the cursor in it.

I attached an example that ilustrates my issues:
1) In the line 27 of Owner.prg the cursor is not loaded
2) I can not to keep the XbpPushButton's edge when it isselected 
selected untill the XbpPushButton loose its focus. It is always returned 
to the"normal" stat.

Could you, please take a look at it?

Fraternally
Beling

Em 21/06/2018 07:41, Andreas Gehrs-Pahl escreveu:
> I don't think this is the issue.
>
>> >From the doc, FILE is used in a named resource identifier
>> but this is NOT for POINTER see \SOURCE\samples\basics\Resource\ResDemo.arc
>
> Quoted from the documentation:
>
> |The value part of the declaration can either be a string literal, or a FILE
> |statement. ICON, BITMAP and POINTER values are treated as file names by
> |default, there is no difference when using FILE on these resource types.
>
> So, the FILE statement (for Pointer Resources) is optional (and redundant),
> but shouldn't make a difference in this case.
>
> As always, a working (or better, failing) example would make much more sense
> here. The problem description(s) are vague and inconsistent (talking about a
> DLL and/or an EXE, with inconsistent file names in the text, attachment, and
> the unexplained image).
>
> In my experience, going through the effort of creating an example program to
> be posted here will have one of two outcomes: either the problem reveals
> itself by creating the demo/test program -- and no post is necessary -- or
> the program makes it possible for other newsgroup readers to reproduce the
> issue and probably provide a solution for the problem.
>
> Either way, it is much more productive than a lot of posts with random
> suggestions that usually lead to nothing concrete.
>
> Just my 2 cents.
>
> Andreas
>


TestPush.zip
Jim LeeRe: XbpPushButton()
on Sun, 24 Jun 2018 00:49:43 +0200
> 2) I can not to keep the XbpPushButton's edge when it isselected
> selected untill the XbpPushButton loose its focus. It is always returned
> to the"normal" stat.

GraEdge() and GraBackground() need visual Style -> Manifest
Carlos a Beling Re: XbpPushButton()
on Tue, 26 Jun 2018 12:13:24 -0300
Hello Jim:
good morning.
Many thanks.
The function GraEdge() is drawn the edge that remains showed until the 
right button is released, existing or not the manifest file (the 
:useVisualStyle of XbpPushButton() defaults to .t., correct?).
Please see the attached screen Edge.png.
I corrected the old one problem about the incorrect usage of the pointer 
and attached the files again for someone, if desired, to see this behavior.
What I could to see is that the item XBP_DRAWINFO_ACTION of the aInfo 
array sends to the :draw() method many events other than the documented 
until the pushbutton to be stabilized and the item XBP_DRAWINFO_STATE 
works of the same way.
This behavior makes the :draw() method to be called many times, each one 
with different event and, if we can not to filter they, the pushbutton 
may to be redrawn for each event.
I would like to select in the method :draw() only the events needed for 
to make it works as the pushbutton _Boxes_, in the example, does.
If it is possible can someone post here how to accomplish this?

Fraternally
Beling






Em 23/06/2018 19:49, Jim Lee escreveu:
>> 2) I can not to keep the XbpPushButton's edge when it isselected
>> selected untill the XbpPushButton loose its focus. It is always returned
>> to the"normal" stat.
>
> GraEdge() and GraBackground() need visual Style -> Manifest
>
>


Edge.png
TestPush.zip
Jose Antonio Diego KerejeRe: XbpPushButton()
on Tue, 26 Jun 2018 18:14:50 +0200
Carlos,

Your implementation of the draw method is incorrect (It should be "similar" 
to the following code).

   INLINE METHOD draw(oPS, aInfo)

          GraBackground( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ 
XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] } )

          IF IsThemeActive( .T. ) = .F.
               GraEdge( aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ 
XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] },;
                               IIF( ::ControlState == XBP_STATE_PRESSED, 
GRA_EDGESTYLE_SUNKEN, GRA_EDGESTYLE_RAISED ) )
          ENDIF

          GraCaptionStr( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ 
XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] - 2 }, ;
                                   ::caption, XBPALIGN_VCENTER + 
XBPALIGN_HCENTER )

          IF BAnd( aInfo[ XBP_DRAWINFO_STATE ], XBP_DRAWSTATE_FOCUS ) == 
XBP_DRAWSTATE_FOCUS ; GraFocusRect( oPS ) ; ENDIF
   RETURN .F.

Neither should you use a sleep(), as it interferes with the ownerdraw 
mechanism.

I sent you a "funny" sample to assign a cursor to a pseudo-deactivated 
button.

Regards. Diego


TEST.zip
Jose Antonio Diego KerejeRe: XbpPushButton()
on Tue, 26 Jun 2018 18:32:02 +0200
typo error in GraEdge

   INLINE METHOD draw(oPS, aInfo)

          GraBackground( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ 
XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] } )

          IF IsThemeActive( .T. ) = .F.
               GraEdge( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ 
XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] },;
                               IIF( ::ControlState == XBP_STATE_PRESSED, 
GRA_EDGESTYLE_SUNKEN, GRA_EDGESTYLE_RAISED ) )
          ENDIF

          GraCaptionStr( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[ 
XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] - 2 }, ;
                                   ::caption, XBPALIGN_VCENTER + 
XBPALIGN_HCENTER )

          IF BAnd( aInfo[ XBP_DRAWINFO_STATE ], XBP_DRAWSTATE_FOCUS ) == 
XBP_DRAWSTATE_FOCUS ; GraFocusRect( oPS ) ; ENDIF
   RETURN .F.
Carlos a Beling Re: XbpPushButton()
on Tue, 26 Jun 2018 17:41:59 -0300
Hello Hello Diego:
Good afternoon.
Many thanks.
I am playing with your sample that is very interesting.
It seemed to me that it is not possible to avoid to repaint the 
pushbutton many times when something changes in it. Is correct this 
thinking?

Fraternally
Beling

Em 26/06/2018 13:32, Jose Antonio Diego Kereje escreveu:
> typo error in GraEdge
>
>    INLINE METHOD draw(oPS, aInfo)
>
>           GraBackground( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[
> XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] } )
>
>           IF IsThemeActive( .T. ) = .F.
>                GraEdge( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[
> XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] },;
>                                IIF( ::ControlState == XBP_STATE_PRESSED,
> GRA_EDGESTYLE_SUNKEN, GRA_EDGESTYLE_RAISED ) )
>           ENDIF
>
>           GraCaptionStr( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[
> XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] - 2 }, ;
>                                    ::caption, XBPALIGN_VCENTER +
> XBPALIGN_HCENTER )
>
>           IF BAnd( aInfo[ XBP_DRAWINFO_STATE ], XBP_DRAWSTATE_FOCUS ) ==
> XBP_DRAWSTATE_FOCUS ; GraFocusRect( oPS ) ; ENDIF
>    RETURN .F.
>
Jose Antonio Diego KerejeRe: XbpPushButton()
on Tue, 26 Jun 2018 23:51:26 +0200
Hi,

I would not do it. For me it's ok

Regards. Diego
Carlos a Beling Re: XbpPushButton()
on Fri, 29 Jun 2018 13:46:52 -0300
Hello.
Good morning.
I was playing - and learning very much - with Diego's testing program 
and I saw:
1) IsThemeActive(.t.) only returns .t. if it has a manifest file with 
the exe name
2) it was not possible - in as many ways that I tried - to change the 
background color. If it is possible, could someone, please, show how?

If someone wants to take a look I attached the example that I used 
(Testing.zip). The lines that I changed are preceded by "//?"

Fraternally
Beling

Em 26/06/2018 13:32, Jose Antonio Diego Kereje escreveu:
>
>           GraBackground( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[
> XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] } )
>
>           IF IsThemeActive( .T. ) = .F.
>                GraEdge( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[
> XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] },;
>                                IIF( ::ControlState == XBP_STATE_PRESSED,
> GRA_EDGESTYLE_SUNKEN, GRA_EDGESTYLE_RAISED ) )
>           ENDIF
>
>           GraCaptionStr( oPS, aInfo[ XBP_DRAWINFO_RECT ], { aInfo[
> XBP_DRAWINFO_RECT, 3 ], aInfo[ XBP_DRAWINFO_RECT, 4 ] - 2 }, ;
>                                    ::caption, XBPALIGN_VCENTER +
> XBPALIGN_HCENTER )
>
>           IF BAnd( aInfo[ XBP_DRAWINFO_STATE ], XBP_DRAWSTATE_FOCUS ) ==
> XBP_DRAWSTATE_FOCUS ; GraFocusRect( oPS ) ; ENDIF


Testing.zip
Jim LeeRe: XbpPushButton()
on Fri, 29 Jun 2018 21:50:28 +0200
> 2) it was not possible - in as many ways that I tried - to change the
> background color. If it is possible, could someone, please, show how?

when using GraBackground(), which is visual Style, you do not see Xbase++ 
Background Color !
same in XbpBrowse():DataArea:Colorblock where Background Color is "behind" 
visual Style

---

as i say you can have different visual Style depend on Button "State"  ( 
aInfo[ XBP_DRAWINFO_STATE ] )
so XBP_DRAWSTATE_DISABLED will return other GraBackground() than 
XBP_DRAWSTATE_NORMAL

there is XBP_DRAWSTATE_SELECTED / XBP_DRAWSTATE_FOCUS but nothing for 
"Hover"
you may enhance o:Enter / o:Leave to simulate "Hover" and use PBS, HOT = 2 
as o:StylePart
Carlos a Beling Re: XbpPushButton()
on Tue, 03 Jul 2018 10:50:51 -0300
Hello Jim.
Good morning.
Many thanks.
Unfortunately I did not undertand what PBS, HOT = 2 meant and I could 
not to find he possible :styleClass values; also :stylePart var is not 
documented in my help file.

Fraternally
Beling

Em 29/06/2018 16:50, Jim Lee escreveu:
>> 2) it was not possible - in as many ways that I tried - to change the
>> background color. If it is possible, could someone, please, show how?
>
> when using GraBackground(), which is visual Style, you do not see Xbase++
> Background Color !
> same in XbpBrowse():DataArea:Colorblock where Background Color is "behind"
> visual Style
>
> ---
>
> as i say you can have different visual Style depend on Button "State"  (
> aInfo[ XBP_DRAWINFO_STATE ] )
> so XBP_DRAWSTATE_DISABLED will return other GraBackground() than
> XBP_DRAWSTATE_NORMAL
>
> there is XBP_DRAWSTATE_SELECTED / XBP_DRAWSTATE_FOCUS but nothing for
> "Hover"
> you may enhance o:Enter / o:Leave to simulate "Hover" and use PBS, HOT = 2
> as o:StylePart
>
>
>
>
>
Jim LeeRe: XbpPushButton()
on Tue, 03 Jul 2018 16:11:06 +0200
> Unfortunately I did not undertand what PBS, HOT = 2 meant and I could not 
> to find he possible :styleClass values; also :stylePart var is not 
> documented in my help file.

Windows Theme are declare in TMSCHEMA.H
Xbase++ use XBP.CH with XBP_STATE_HOT as Diego show in his Sample.
Carlos a Beling Re: XbpPushButton()
on Tue, 03 Jul 2018 11:30:04 -0300
Hello JIm.
Many thanks again.
The sample that Diego posted is what I was trying to do.
And I agree with him about "flat" buttons.

Fraternally
Beling

Em 03/07/2018 11:11, Jim Lee escreveu:
>> Unfortunately I did not undertand what PBS, HOT = 2 meant and I could not
>> to find he possible :styleClass values; also :stylePart var is not
>> documented in my help file.
>
> Windows Theme are declare in TMSCHEMA.H
> Xbase++ use XBP.CH with XBP_STATE_HOT as Diego show in his Sample.
>
>
Jose Antonio Diego KerejeRe: XbpPushButton()
on Sat, 30 Jun 2018 00:20:01 +0200
Hi,

The implementation of the method of my previous sample was intended to 
replicate the standard look of a button to later add, for example, an icon 
or any other complement.

If you want a non-standard look, not subject to windows themes, you can do 
it in many ways. This is one of them (I prefer flat looks, but I used 
gradients in the code)

Regards. Diego


TEST.zip
Carlos a Beling Re: XbpPushButton()
on Tue, 03 Jul 2018 10:52:54 -0300
Hello Diego;
Good morning.
Many thanks again.
Of sure I will play with yours example.

Fraternally
Beling

Em 29/06/2018 19:20, Jose Antonio Diego Kereje escreveu:
> Hi,
>
> The implementation of the method of my previous sample was intended to
> replicate the standard look of a button to later add, for example, an
> icon or any other complement.
>
> If you want a non-standard look, not subject to windows themes, you can
> do it in many ways. This is one of them (I prefer flat looks, but I used
> gradients in the code)
>
> Regards. Diego
Carlos a Beling Re: XbpPushButton()
on Tue, 03 Jul 2018 11:30:38 -0300
Hello Diego.Good morning.
Bingo!

Fraternally
Beling

Em 29/06/2018 19:20, Jose Antonio Diego Kereje escreveu:
> Hi,
>
> The implementation of the method of my previous sample was intended to
> replicate the standard look of a button to later add, for example, an
> icon or any other complement.
>
> If you want a non-standard look, not subject to windows themes, you can
> do it in many ways. This is one of them (I prefer flat looks, but I used
> gradients in the code)
>
> Regards. Diego
Jim LeeRe: XbpPushButton()
on Tue, 26 Jun 2018 22:29:04 +0200
> existing or not the manifest file (the :useVisualStyle of XbpPushButton() 
> defaults to .t., correct?).
> Please see the attached screen Edge.png.

your Picture show old Button Style so your Manifest does not work correct.

---

visual Style are define in TMSCHEMA.H

//---------------------------------------------------------------------------------------
   "Button" Parts & States
//---------------------------------------------------------------------------------------
BEGIN_TM_CLASS_PARTS(BUTTON)
  TM_PART(1, BP, PUSHBUTTON)
  TM_PART(2, BP, RADIOBUTTON)
  TM_PART(3, BP, CHECKBOX)
  TM_PART(4, BP, GROUPBOX)
  TM_PART(5, BP, USERBUTTON)
END_TM_CLASS_PARTS()

BEGIN_TM_PART_STATES(PUSHBUTTON)
  TM_STATE(1, PBS, NORMAL)
  TM_STATE(2, PBS, HOT)
  TM_STATE(3, PBS, PRESSED)
  TM_STATE(4, PBS, DISABLED)
  TM_STATE(5, PBS, DEFAULTED)
END_TM_PART_STATES()

Diego have show in his Code how to use o::ControlState XBP_STATE_PRESSED = 
PBS, PRESSED

---

in your Code i saw

    o:enter := {| aPos, uNIL, self | ... }

but no

   o:leave := {| uNIL1, uNIL2, self | ... }

both work on Xbase++ Level and can "simulate Hover"

---

Windows change visual Style using PBS, HOT when "Hover" a Button.
but it is NOT the Control ... it is Mouse "Tracking"

      IF ::drawMode <> XBP_DRAW_NORMAL
           ::oTrackMouseEvent      := TRACKMOUSEEVENT():NEW()
           ::oTrackMouseEvent:cbSize      := ::oTrackMouseEvent:_sizeof_()
           ::oTrackMouseEvent:dwFlags     := nOr(TME_HOVER,TME_LEAVE)
           ::oTrackMouseEvent:dwHoverTime := HOVER_DEFAULT
           ::oTrackMouseEvent:hwndTrack   := ::hXbp

           @User32:TrackMouseEvent(::oTrackMouseEvent)
      ENDIF

so when Mouse "Enter/Leave" Control those Event are fired to change visual 
Style ... or something else 

---

so you have 2 Ways : Xbase++ or native Windows

if you want to go native Way have a look on Pablos Website www.xbwin.com -> 
Newsgroup for DXE Lib
Carlos a Beling Re: XbpPushButton()
on Tue, 26 Jun 2018 17:56:20 -0300
Hello Jim.
Good evening.
Many thanks.
I prefer to use the Xbase++ way because it is for me simplest to use.
Yours tips was very useful and I learned that the pushbuttons need to be 
controlled  in the subclass for they to work as someone wants.

Fraternally
Beling

Em 26/06/2018 17:29, Jim Lee escreveu:
>> existing or not the manifest file (the :useVisualStyle of XbpPushButton()
>> defaults to .t., correct?).
>> Please see the attached screen Edge.png.
>
> your Picture show old Button Style so your Manifest does not work correct.
>
> ---
>
> visual Style are define in TMSCHEMA.H
>
> //---------------------------------------------------------------------------------------
>    "Button" Parts & States
> //---------------------------------------------------------------------------------------
> BEGIN_TM_CLASS_PARTS(BUTTON)
>    TM_PART(1, BP, PUSHBUTTON)
>    TM_PART(2, BP, RADIOBUTTON)
>    TM_PART(3, BP, CHECKBOX)
>    TM_PART(4, BP, GROUPBOX)
>    TM_PART(5, BP, USERBUTTON)
> END_TM_CLASS_PARTS()
>
> BEGIN_TM_PART_STATES(PUSHBUTTON)
>    TM_STATE(1, PBS, NORMAL)
>    TM_STATE(2, PBS, HOT)
>    TM_STATE(3, PBS, PRESSED)
>    TM_STATE(4, PBS, DISABLED)
>    TM_STATE(5, PBS, DEFAULTED)
> END_TM_PART_STATES()
>
> Diego have show in his Code how to use o::ControlState XBP_STATE_PRESSED =
> PBS, PRESSED
>
> ---
>
> in your Code i saw
>
>      o:enter := {| aPos, uNIL, self | ... }
>
> but no
>
>     o:leave := {| uNIL1, uNIL2, self | ... }
>
> both work on Xbase++ Level and can "simulate Hover"
>
> ---
>
> Windows change visual Style using PBS, HOT when "Hover" a Button.
> but it is NOT the Control ... it is Mouse "Tracking"
>
>        IF ::drawMode <> XBP_DRAW_NORMAL
>             ::oTrackMouseEvent      := TRACKMOUSEEVENT():NEW()
>             ::oTrackMouseEvent:cbSize      := ::oTrackMouseEvent:_sizeof_()
>             ::oTrackMouseEvent:dwFlags     := nOr(TME_HOVER,TME_LEAVE)
>             ::oTrackMouseEvent:dwHoverTime := HOVER_DEFAULT
>             ::oTrackMouseEvent:hwndTrack   := ::hXbp
>
>             @User32:TrackMouseEvent(::oTrackMouseEvent)
>        ENDIF
>
> so when Mouse "Enter/Leave" Control those Event are fired to change visual
> Style ... or something else 
>
> ---
>
> so you have 2 Ways : Xbase++ or native Windows
>
> if you want to go native Way have a look on Pablos Website www.xbwin.com ->
> Newsgroup for DXE Lib
>
>
>
Andreas Gehrs-Pahl
Re: XbpPushButton()
on Sat, 23 Jun 2018 19:14:49 -0400
Carlos,

>I attached an example that ilustrates my issues:
>1) In the line 27 of Owner.prg the cursor is not loaded
>2) I can not to keep the XbpPushButton's edge when it isselected 
>selected untill the XbpPushButton loose its focus. It is always returned 
>to the"normal" stat.

There are a lot of small issues with this project, but the two that prevent 
your cursor from being shown are rather trivial:

The Pointer Resource can't be found, as it's Resource ID is wrong and you 
also never actually call the code where the Pointer is changed.

To fix this, add the following two lines to your project:

1) Add the following line at the top of the "Pointer.arc" file:

#include "Pointer.ch"

2) Either move the :SetPointer() call some place where it is executed, or 
   manually call the :Enable() method. The simplest way would be to add the 
   following line to the "Static.prg" file, somewhere below the line where 
   you :Create() your "PushOwner" object:

oXbp:Enable()

After those changes, your new cursor will be shown when the mouse is over 
the button.

Hope that helps,

BTW: I'm available for software development as well as tutoring/coaching,
if you need any additional help.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Carlos a Beling Re: XbpPushButton()
on Tue, 26 Jun 2018 11:05:30 -0300
Hello Andreas.
Good morning.
Many thanks again. It worked fine.

Fraternally
Beling

Em 23/06/2018 20:14, Andreas Gehrs-Pahl escreveu:
> Carlos,
>
>> I attached an example that ilustrates my issues:
>> 1) In the line 27 of Owner.prg the cursor is not loaded
>> 2) I can not to keep the XbpPushButton's edge when it isselected
>> selected untill the XbpPushButton loose its focus. It is always returned
>> to the"normal" stat.
>
> There are a lot of small issues with this project, but the two that prevent
> your cursor from being shown are rather trivial:
>
> The Pointer Resource can't be found, as it's Resource ID is wrong and you
> also never actually call the code where the Pointer is changed.
>
> To fix this, add the following two lines to your project:
>
> 1) Add the following line at the top of the "Pointer.arc" file:
>
> #include "Pointer.ch"
>
> 2) Either move the :SetPointer() call some place where it is executed, or
>     manually call the :Enable() method. The simplest way would be to add the
>     following line to the "Static.prg" file, somewhere below the line where
>     you :Create() your "PushOwner" object:
>
> oXbp:Enable()
>
> After those changes, your new cursor will be shown when the mouse is over
> the button.
>
> Hope that helps,
>
> BTW: I'm available for software development as well as tutoring/coaching,
> if you need any additional help.
>
> Andreas
>
Andreas Gehrs-Pahl
Re: XbpPushButton()
on Thu, 21 Jun 2018 08:55:08 -0400
Carlos,

>Here are the ARC file lines:
>POINTER
>  cabPTR_UNAVAIABLE  = FILE 'C:\MSI\Gui\Resource\Source\Unavailable.cur'

File names, as well as pretty much all literals, must be in double quotes, 
rather than single quotes, in Alaska Resource Compiler (*.ARC) files. The 
same is true for the Preprocessor directives (#pragma etc.), in most cases.

Try to change the above to:

POINTER
  cabPTR_UNAVAIABLE = "C:\MSI\Gui\Resource\Source\Unavailable.cur"

and let us know if that fixes it.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC