DrawEdge - New feature

Source code related resources

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

DrawEdge - New feature

Post by Pablo César » Sat Dec 07, 2013 10:57 pm

The Win32 API features a new function called DrawEdge. Its purpose is to draw 3D effects for all Windows applications. And this function was missing in HMG and Minigui.

The DrawEdge function is a useful function provided by the Win32 API. It can draw a variety of the edge styles used to draw buttons, frames and borders around controls and forms.

I made a Demo to show how each controls can be draw it. Not all components looks like pretty, but can be used as you wish.

I added a GetControlCoords which returns the coordinates for one specific control (position/size). There is also a 3rd parameter which programmer can use just to adjust for fit around the control in pixels. IMO this function would it beadd to HMG library at h_controlmisc.prg, so that everyone can use with some certain frequency.

If anyone has any suggestions or has made ​​some improvement, please excite in to say/describe so we can improve the code.

I hope this resource is useful and you enjoyed.

<Attached files was removed. Please note in last message of topic updated version.>
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
esgici
Posts: 4425
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 306 times
Been thanked: 99 times
Contact:

Post by esgici » Sat Dec 07, 2013 11:15 pm

Pablo César wrote:The Win32 API features a new function called DrawEdge. Its purpose is to draw 3D effects for all Windows applications. And this function was missing in HMG and Minigui.

The DrawEdge function is a useful function provided by the Win32 API. It can draw a variety of the edge styles used to draw buttons, frames and borders around controls and forms.

I made a Demo to show how each controls can be draw it. Not all components looks like pretty, but can be used as you wish.

I added a GetControlCoords which returns the coordinates for one specific control (position/size). There is also a 3rd parameter which programmer can use just to adjust for fit around the control in pixels. IMO this function would it beadd to HMG library at h_controlmisc.prg, so that everyone can use with some certain frequency.

If anyone has any suggestions or has made ​​some improvement, please excite in to say/describe so we can improve the code.

I hope this resource is useful and you enjoyed.
hbmk2: Compiling Harbour sources...
Harbour 3.2.0dev (Rev. 18911)
Copyright (c) 1999-2013, http: // harbour - project . org
C:\test\DrawEdge\main.prg(43) Error E0030 Syntax error "syntax error at '.'"
...
C:\test\DrawEdge\main.prg(160) Error E0030 Syntax error "syntax error at '.'"

44 errors

No code generated.

<this post edited by author (BE) >

Last edited by esgici on Sun Dec 08, 2013 2:54 pm, edited 2 times in total.
Viva INTERNATIONAL HMG :D

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Sat Dec 07, 2013 11:45 pm

esgici wrote:
Pablo César wrote:The Win32 API features a new function called DrawEdge. Its purpose is to draw 3D effects for all Windows applications. And this function was missing in HMG and Minigui.

The DrawEdge function is a useful function provided by the Win32 API. It can draw a variety of the edge styles used to draw buttons, frames and borders around controls and forms.

I made a Demo to show how each controls can be draw it. Not all components looks like pretty, but can be used as you wish.

I added a GetControlCoords which returns the coordinates for one specific control (position/size). There is also a 3rd parameter which programmer can use just to adjust for fit around the control in pixels. IMO this function would it beadd to HMG library at h_controlmisc.prg, so that everyone can use with some certain frequency.

If anyone has any suggestions or has made ​​some improvement, please excite in to say/describe so we can improve the code.

I hope this resource is useful and you enjoyed.

Code: Select all

hbmk2: Compiling Harbour sources...
Harbour 3.2.0dev (Rev. 18911)
Copyright (c) 1999-2013, http://harbour-project.org" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;

C:\test\DrawEdge\main.prg(43) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(44) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(45) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(46) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(56) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(57) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(58) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(59) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(69) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(70) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(71) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(72) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(82) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(83) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(84) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(85) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(95) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(96) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(97) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(98) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(108) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(109) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(110) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(111) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(129) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(130) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(131) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(132) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(134) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(135) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(136) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(137) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(139) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(140) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(141) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(142) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(144) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(145) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(146) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(147) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(157) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(158) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(159) Error E0030  Syntax error "syntax error at '.'"
C:\test\DrawEdge\main.prg(160) Error E0030  Syntax error "syntax error at '.'"

44 errors

No code generated.
These errors starting in source file at:

Form.HANDLE

It is the same that: GetFormHandle ( cForm )

This example was compilated with 3.1.5 UNICODE (with patches applied).

Source code was optimized a bit. Please replace Form.HANDLE with GetFormHandle ( cForm ) in case is persisting errors in your HMG and recompile it.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Sat Dec 07, 2013 11:47 pm

Optimized code and added a FRAMEs options too (not so nice) but can gives an idea to replace frames for DrawEdge.

<Attached files was removed. Please see at last message with updated files.>
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Sat Dec 07, 2013 11:55 pm

esgici wrote:
Pablo César wrote:Optimized code and added a FRAMEs options too (not so nice) but can gives an idea to replace frames for DrawEdge.
Harbour 3.2.0dev (Rev. 18911)
Copyright (c) 1999-2013, http://harbour-project.org/" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;

C:\test\DrawEdge\DrawEdge2\main.prg(43) Error E0030 Syntax error "syntax error at '.'"
C:\test\DrawEdge\DrawEdge2\main.prg(58) Error E0030 Syntax error "syntax error at '.'"
C:\test\DrawEdge\DrawEdge2\main.prg(73) Error E0030 Syntax error "syntax error at '.'"
C:\test\DrawEdge\DrawEdge2\main.prg(88) Error E0030 Syntax error "syntax error at '.'"
C:\test\DrawEdge\DrawEdge2\main.prg(103) Error E0030 Syntax error "syntax error at '.'"
C:\test\DrawEdge\DrawEdge2\main.prg(118) Error E0030 Syntax error "syntax error at '.'"
C:\test\DrawEdge\DrawEdge2\main.prg(182) Error E0030 Syntax error "syntax error at '.'"

7 errors

No code generated.


:mrgreen:
Esgici, please note
Pablo César wrote:It is the same that: GetFormHandle ( cForm )

This example was compilated with 3.1.5 UNICODE (with patches applied).

Source code was optimized a bit. Please replace Form.HANDLE with GetFormHandle ( cForm ) in case is persisting errors in your HMG and recompile it.
Because I have NO problems with this compilation here. Which version are you using ? More details please.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
esgici
Posts: 4425
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 306 times
Been thanked: 99 times
Contact:

Post by esgici » Sun Dec 08, 2013 12:07 am

OK, fixed;
DrawEdges.jpg
Draw edges screen shoot
DrawEdges.jpg (100.03 KiB) Viewed 1860 times
good improvement, thanks :arrow:
Viva INTERNATIONAL HMG :D

User avatar
bpd2000
Posts: 999
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 150 times
Been thanked: 65 times

Post by bpd2000 » Sun Dec 08, 2013 5:24 am

Nice improvement Pablo César
BPD
Convert Dream into Reality through HMG

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Sun Dec 08, 2013 11:00 am

esgici wrote:OK, fixed
Image
Ok, good. But what it happen ? How you fixed ?

MonthCalendar are displayed in different sizes in XP and Win7. And Width and Height can not manipulate without cutting off part from both. So by this reason is good to use IsXp() to differenciate size/positions. Note in following lines:

Setproperty("Screen_1","Width",GetProperty("Screen_1","Width")+(If(_HMG_SYSDATA [ 250 ],0,100)))

_HMG_SYSDATA [ 250 ] is logical value as true when is in XP.
bpd2000 wrote:Nice improvement Pablo César
Thank you Dave to show your interest. :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
serge_girard
Posts: 2030
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 379 times
Been thanked: 87 times
Contact:

Post by serge_girard » Sun Dec 08, 2013 11:18 am

Nice Pablo!

Serge

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Sun Dec 08, 2013 11:22 am

serge_girard wrote:Nice Pablo!

Serge
Thank you Dhr. Serge for your interest.

I'm Happy you have liked it :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply