FontColor and button - is it possible to change?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
quartz565
Posts: 670
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

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

Post by quartz565 »

Thank you Krzysztof !
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

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

Post 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 2796 times
Button_Round.JPG
Button_Round.JPG (10.19 KiB) Viewed 2796 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
---
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

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

Post 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 :?:
have fun
Jimmy
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

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

Post 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.
Attachments
MenuNoButton.zip
(2.5 MiB) Downloaded 157 times
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

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

Post 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 1915 times
MYBUTT2.ZIP
(5.85 KiB) Downloaded 155 times
have fun
Jimmy
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

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

Post 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.
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
Post Reply