Page 5 of 5

Re: FontColor and button - is it possible to change?

Posted: Tue Jan 24, 2017 4:03 pm
by quartz565
Thank you Krzysztof !

Re: FontColor and button - is it possible to change?

Posted: Thu Oct 31, 2019 3:11 am
by AUGE_OHR
hi,

Great Work, THX

it show me how Ownerdraw with HMG work.

some Question and Comment :

in OwnButton.prg HB_FUNC( OWNBUTTONDRAW ) i saw ODS_DISABLED and ODS_FOCUS.
as it is a WC_Button it is IMHO not full State

Code: Select all

      DO CASE
         CASE nState = ODS_FOCUS + ODS_SELECTED
            iStateId := PBS_PRESSED
         CASE nState = ODS_FOCUS
            iStateId := PBS_HOT
         CASE nState = ODS_DISABLED
            iStateId := PBS_DISABLED
         CASE nState = ODS_GRAYED
            iStateId := PBS_DISABLED
      OTHERWISE
         iStateId := PBS_NORMAL
      ENDCASE
so we got 5 State instead of 3

---

about "Round" Button : i guess Ellipse() is a GDI Function. ;)

what about CreateEllipticRgn() Function
https://docs.microsoft.com/en-us/window ... llipticrgn
Button_Rect.JPG
Button_Rect.JPG (10.69 KiB) Viewed 2793 times
Button_Round.JPG
Button_Round.JPG (10.19 KiB) Viewed 2793 times

Code: Select all

DLLFUNCTION CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect) USING STDCALL FROM GDI32.DLL

LOCAL nFrame := GetSystemMetrics(SM_CYBORDER)

   hHwnd := oObj:GetHwnd()
   aTmp  := oObj:Currentsize()

   nLeftRect   := 0       +nFrame
   nTopRect    := aTmp[2] -nFrame
   nRightRect  := aTmp[1] -nFrame
   nBottomRect := 0       +nFrame

   // now construct a Region and call its API function
   //
   hRgn := CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect)
   SetWindowRgn(hHwnd,hRgn,.t.)

   // clean up
   //
   IF .NOT. EMPTY(hRgn)
       DeleteObject(hRgn)
   ENDIF
---

Re: FontColor and button - is it possible to change?

Posted: Wed Dec 16, 2020 2:14 am
by AUGE_OHR
hi Edward,

i have run your OwnButton Demo, GREAT :!:

now i want to integrate it in my HMG App but have Problem ...
new Control are not in HMG "System Array" and not "visible" in Debugger. :(

i can not "identify" Control using

Code: Select all

   IF GetControlIndexByHandle( hWnd ) > 0
      GetControlNameByHandle( hWnd, @cControlName, @cFormName )

      hWnd :=GetControlHandle( cLabel, "Form_1" )
i guess i need a own "Control Array" to handle OwnButton :idea:

---

the is a Sample MYButton. how can i use Sample and modify it for OwnButton :?:

Re: FontColor and button - is it possible to change?

Posted: Wed Dec 16, 2020 11:38 am
by Claudio Ricardo
Hi All...
When i need custom button's, replace this with image and label, work fine !
(Take from "Main.prg" to my last project, and comment unnecessary lines for this sample work)
Compiled with HMG 3.4.4 32 bits.

Re: FontColor and button - is it possible to change?

Posted: Wed Dec 16, 2020 9:10 pm
by AUGE_OHR
hi,

your Menu-Button are very nice.
but my Question is not only Button, it is the Sample for "own" Control.

Edwars have made those Ownerdraw Button but as i say it does not use "System Array".
MyButton Sample "fill _HMG_SYSDATA" but "where" do i add "more" like Color for Gradient ?

---

same Question with CLASS Code ... how to "fill _HMG_SYSDATA" ?
MyButton_2.jpg
MyButton_2.jpg (18.86 KiB) Viewed 1912 times
MYBUTT2.ZIP
(5.85 KiB) Downloaded 154 times

Re: FontColor and button - is it possible to change?

Posted: Sat Dec 19, 2020 3:31 am
by Claudio Ricardo
Hi...
Sorry I didn't get that far in HMG yet, how to create my own controls.
For now I need to learn a lot more about HMG and its benefits.
So with image and label I simulated some. :oops:
Now I have a lot of work, but as soon as I have time, I will study the HMG libs and Win API.

Hola...
Disculpá, aún no llegue tan lejos con HMG cómo para crear mis propios controles,
mientras sigo aprendiendo cómo aprovechar todas las bondades de HMG.
Por eso simulé unos botones diferentes con "label" e "image" :oops:
Cuándo disponga de más tiempo libre, intentaré estudiar las libs y el API.