Page 13 of 21

Re: HMG.3.4.2

Posted: Tue Oct 27, 2015 3:16 pm
by mol
This sample was compiled with 342 patch 2.
Where is background color?

Re: HMG.3.4.2

Posted: Tue Oct 27, 2015 3:29 pm
by Rathinagiri
Marek,

Please compile this code and tell me whether you get the same result.

Code: Select all

#include <hmg.ch>

Function Main

   define window cm at 0, 0 width 800 height 600 main title 'Circle Magic'
      define button draw
         row 10
         col 10
         caption 'Draw'
         width 50
         action draw()
      end button   
      define label innerrlabel
         row 15
         col 70
         width 90
         value 'Inner Planet R'
      end label
      define spinner innerr
         row 10
         col 160
         width 60
         rangemin 5
         rangemax 150
         increment 5
         value 80
      end spinner
      define label outerrlabel
         row 15
         col 230
         width 90
         value 'Outer Planet R'
      end label
      define spinner outerr
         row 10
         col 320
         width 60
         rangemin 5
         rangemax 200
         increment 5
         value 110
      end spinner
      define label backcolorlabel
         row 10
         col 390
         width 90
         value 'Back Color'
      end label   
      define label backcolor
         row 15
         col 480
         width 50
         height 20
         backcolor { 255, 255, 255 }         
         onclick getbackcolor()
      end label 
      define label animationspeed
         row 15
         col 540
         width 100 
         value 'Animation Speed'         
      end label   
      define spinner anispeed
         row 10
         col 640
         width 80
         rangemin 1000
         rangemax 100000
         value 50000
         increment 5000
      end spinner
      define label innerspeed
         row 45
         col 70
         width 90
         value 'Inner Speed'
      end label
      define spinner speed
         row 40
         col 160
         width 60
         rangemin 1
         rangemax 50
         value 20
         increment 1
      end spinner
      define label outerspeed
         row 45
         col 230
         width 90
         value 'Outer Speed'
      end label
      define spinner ospeed
         row 40
         col 320
         width 60
         rangemin 1
         rangemax 50
         value 3
         increment 1
      end spinner
      define label revolutionslabel
         row 45
         col 390
         width 90
         value 'Revolutions'
      end label
      define spinner revolutions
         row 40
         col 480
         width 60
         rangemin 1
         rangemax 50
         value 1
         increment 1
      end spinner
      define checkbox stereo
         row 40
         col 550
         width 70
         caption 'Stereo'
         backcolor { 255, 255, 0 }
         value .f.
      end checkbox   
      define spinner base
         row 40
         col 630
         width 60
         rangemin 2
         rangemax 50
         value 20
         increment 2
      end spinner
   end window
   cm.center
   cm.activate


Return


function drawstereo
LOCAL  hDC, BTstruct
local nSmallRadius := cm.innerr.value
local nBigRadius := cm.outerr.value
local nBigRevolutions := cm.revolutions.value
local nInnerSpeed := cm.speed.value
local nOuterSpeed := cm.ospeed.value
local nCenterCol := 400
local nCenterRow := 300
local nSmallRow := 0
local nSmallCol := 0
local nBigRow := 0
local nBigCol := 0
local nDotRadius := 1
local nSmallDots := 360
local nBigDots := round( nSmallDots * nBigRadius / nSmallRadius, 0 )
local aLSmall := {}
local aLBig := {}
local aRSmall := {}
local aRBig := {}
local nRadians := 0.0174532925
local nSmallCount := 0
local nBigCount := 0
local nMax := 150
local nAniSpeed := cm.anispeed.value
local nStereoBase := cm.base.value

local nLSmallCenterCol := nCenterCol - 200 - ( nStereoBase / 2 )
local nRSmallCenterCol := nCenterCol + 200 + ( nStereoBase / 2 )

local nLBigCenterCol := nCenterCol - 200 + ( nStereoBase / 2 )
local nRBigCenterCol := nCenterCol + 200 - ( nStereoBase / 2 )

if nSmallRadius < 10 
   nSmallRadius := 10
   cm.innerr.value := nSmallRadius
endif   

if nBigRadius > nMax
   nBigRadius := nMax
   cm.outerr.value := nBigRadius
endif

if nSmallRadius > nBigRadius + 10
   nSmallRadius := nBigRadius - 10
   cm.innerr.value := nSmallRadius
endif

if nBigRadius <= nSmallRadius + 10
   nBigRadius := nSmallRadius + 10
   cm.outerr.value := nBigRadius
endif

   

hDC := BT_CreateDC ( "cm", BT_HDC_ALLCLIENTAREA, @BTstruct ) 
BT_DrawFillRectangle (hDC, 150, 20, 770, 300, cm.backcolor.backcolor, cm.backcolor.backcolor, 1)


for i := 1 to nSmallDots
   nSmallRow := nCenterRow + nSmallRadius * Cos( i / ( nSmallDots / 360 ) * nRadians ) 
   nSmallCol := nCenterCol + nSmallRadius * Sin( i / ( nSmallDots / 360 ) * nRadians )
   nLSmallCol := nLSmallCenterCol + nSmallRadius * Sin( i / ( nSmallDots / 360 ) * nRadians )
   nRSmallCol := nRSmallCenterCol + nSmallRadius * Sin( i / ( nSmallDots / 360 ) * nRadians )
   aadd( aLSmall, { nSmallRow, nLSmallCol } )
   aadd( aRSmall, { nSmallRow, nRSmallCol } )
   && if msgyesno( str( nSmallRow ) + ' ' + str( nLSmallCol ) + ' ' + str( nSmallRow ) + ' ' + str( nRSmallCol ) )
      && BT_DeleteDC (BTstruct)
      && return nil
   && endif
//   BT_DrawEllipse ( hDC, nSmallRow, nSmallCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
//   BT_DrawEllipse ( hDC, nSmallRow, nLSmallCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
   BT_DrawEllipse ( hDC, nSmallRow, nLSmallCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
   BT_DrawEllipse ( hDC, nSmallRow, nRSmallCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
next i   
for i := 1 to nBigDots
   nBigCol := nCenterCol + nBigRadius * Sin( i / ( nBigDots / 360 ) * nRadians )
   nBigRow := nCenterRow + nBigRadius * Cos( i / ( nBigDots / 360 ) * nRadians ) 
   nLBigCol := nLBigCenterCol + nBigRadius * Sin( i / ( nBigDots / 360 ) * nRadians )
   nRBigCol := nRBigCenterCol + nBigRadius * Sin( i / ( nBigDots / 360 ) * nRadians )
   aadd( aLBig, { nBigRow, nLBigCol } )
   aadd( aRBig, { nBigRow, nRBigCol } )
   BT_DrawEllipse ( hDC, nBigRow, nLBigCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
   BT_DrawEllipse ( hDC, nBigRow, nRBigCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
next i
&& BT_DeleteDC (BTstruct)
&& RETURN

nSmallCount := 1
nBigCount := 1
nCount := int( nBigDots * nBigRevolutions / nOuterSpeed )
for i := 1 to  nCount
   nBigCount := nBigCount + nOuterSpeed
   nSmallCount := nSmallCount + nInnerSpeed
   if nSmallCount > nSmallDots
      nSmallCount := nSmallCount - nSmallDots 
   endif
   if nBigCount > nBigDots 
      nBigCount := nBigCount - nBigDots
   endif
   nRandomR := random( 255 )
   nRandomG := random( 255 )
   nRandomB := random( 255 )
   nSmallRow := aLSmall[ nSmallCount, 1 ]
   nLSmallCol := aLSmall[ nSmallCount, 2 ]
   nRSmallCol := aRSmall[ nSmallCount, 2 ]
   nBigRow := aLBig[ nBigCount, 1 ]
   nLBigCol := aLBig[ nBigCount, 2 ]
   nRBigCol := aRBig[ nBigCount, 2 ]
   BT_DrawLine ( hDC, nSmallRow, nLSmallCol, nBigRow, nLBigCol, { nRandomR, nRandomG, nRandomB } )
   BT_DrawLine ( hDC, nSmallRow, nRSmallCol, nBigRow, nRBigCol, { nRandomR, nRandomG, nRandomB } )
   for j := 1 to nAniSpeed
   next j
   Do Events
next i
BT_DeleteDC (BTstruct)
RETURN


function getbackcolor
   local aRGB := cm.backcolor.backcolor
   local aNewRGB := aclone( aRGB )
   aNewRGB := getcolor( aRGB )   
   if aNewRGB[ 1 ] <> Nil
      cm.backcolor.backcolor := aNewRGB
   endif
   return nil







function draw
LOCAL  hDC, BTstruct
local nSmallRadius := cm.innerr.value
local nBigRadius := cm.outerr.value
local nBigRevolutions := cm.revolutions.value
local nInnerSpeed := cm.speed.value
local nOuterSpeed := cm.ospeed.value
local nCenterCol := 400
local nCenterRow := 300
local nSmallRow := 0
local nSmallCol := 0
local nBigRow := 0
local nBigCol := 0
local nDotRadius := 1
local nSmallDots := 360
local nBigDots := round( nSmallDots * nBigRadius / nSmallRadius, 0 )
local aSmall := {}
local aBig := {}
local nRadians := 0.0174532925
local nSmallCount := 0
local nBigCount := 0
local nMax := 200
local nAniSpeed := cm.anispeed.value

if cm.stereo.value
   drawstereo()
   return nil
endif   

if nSmallRadius < 10 
   nSmallRadius := 10
   cm.innerr.value := nSmallRadius
endif   

if nBigRadius > nMax
   nBigRadius := nMax
   cm.outerr.value := nBigRadius
endif

if nSmallRadius > nBigRadius + 10
   nSmallRadius := nBigRadius - 10
   cm.innerr.value := nSmallRadius
endif

if nBigRadius <= nSmallRadius + 10
   nBigRadius := nSmallRadius + 10
   cm.outerr.value := nBigRadius
endif

   

hDC := BT_CreateDC ( "cm", BT_HDC_ALLCLIENTAREA, @BTstruct ) 
BT_DrawFillRectangle (hDC, 150, 20, 770, 300, cm.backcolor.backcolor, cm.backcolor.backcolor, 1)


for i := 1 to nSmallDots
   nSmallRow := nCenterRow + nSmallRadius * Cos( i / ( nSmallDots / 360 ) * nRadians ) 
   nSmallCol := nCenterCol + nSmallRadius * Sin( i / ( nSmallDots / 360 ) * nRadians )
   aadd( aSmall, { nSmallRow, nSmallCol } )
   BT_DrawEllipse ( hDC, nSmallRow, nSmallCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
next i   
for i := 1 to nBigDots
   nBigCol := nCenterCol + nBigRadius * Sin( i / ( nBigDots / 360 ) * nRadians )
   nBigRow := nCenterRow + nBigRadius * Cos( i / ( nBigDots / 360 ) * nRadians ) 
   aadd( aBig, { nBigRow, nBigCol } )
   BT_DrawEllipse ( hDC, nBigRow, nBigCol, nDotRadius, nDotRadius, { 0, 0, 0 } )
next i
nSmallCount := 1
nBigCount := 1
nCount := int( nBigDots * nBigRevolutions / nOuterSpeed )
for i := 1 to  nCount
   nBigCount := nBigCount + nOuterSpeed
   nSmallCount := nSmallCount + nInnerSpeed
   if nSmallCount > nSmallDots
      nSmallCount := nSmallCount - nSmallDots 
   endif
   if nBigCount > nBigDots 
      nBigCount := nBigCount - nBigDots
   endif
   nRandomR := random( 255 )
   nRandomG := random( 255 )
   nRandomB := random( 255 )
   nSmallRow := aSmall[ nSmallCount, 1 ]
   nSmallCol := aSmall[ nSmallCount, 2 ]
   nBigRow := aBig[ nBigCount, 1 ]
   nBigCol := aBig[ nBigCount, 2 ]
   BT_DrawLine ( hDC, nSmallRow, nSmallCol, nBigRow, nBigCol, { nRandomR, nRandomG, nRandomB } )
   for j := 1 to nAniSpeed
   next j
   Do Events
next i
BT_DeleteDC (BTstruct)
RETURN



Re: HMG.3.4.2

Posted: Tue Oct 27, 2015 3:38 pm
by srvet_claudio
Rathinagiri wrote:For me it is working nice. Mine is Win7 64 Bits but compiled used HMG 3.4.2 32 Bits.
+1
Win10 compiled with 32 and 64-bit

Re: HMG.3.4.2

Posted: Tue Oct 27, 2015 5:26 pm
by mol
I found it - the whole control becomes bleck, when I defined TRANSPARENT as .t. + BACKGROUND color.
When Transparent is OFF, everything looks OK.
Sorry for my bug :-)

Re: HMG.3.4.2

Posted: Tue Oct 27, 2015 5:43 pm
by Rathinagiri
Thank you for finding this.

Re: HMG.3.4.2

Posted: Tue Oct 27, 2015 6:07 pm
by mol
I'm testing my app in Windows XP and I have a problem with GRID control.
Image

This problem was present in earlier library and the only one solution was to build library as unicode.
Now, it doesn't help.
How to resolve it?

I want to point, I'm not using UNICODE, my whole app use ANSI only

Re: HMG.3.4.2

Posted: Wed Oct 28, 2015 10:57 am
by mol
GRID problem does not occur in Windows 7 prof/64. It works bad in Windows XP prof. I'm testing on real machine and virtual machine - always the same :-( horrible problems with strange characters.

Please, help! In other case, I need to return to hmg 340

Re: HMG.3.4.2

Posted: Wed Oct 28, 2015 11:09 am
by mol
As I wrote previously, I want to point some comments to DEBUGGER.
It's really good looking and working solution.
But, in my opinion - it looks too good - icons are too large - in small resolution debugger takes 1/2 of display.
Form of debugger is always on top - you can only minimize it. It shuld be the way to move app window to top.
All tabs, eg. Source, Stack, Watch etc. should be moved to child windows if it's possible.
Tab "ABOUT" should be last - not first - I know, it's very important, but, it's a debugger tool not promotional tool.
It would be great to have keyboard shortcuts to most used functionalities - as in standard harbour debugger - F5, F8, F10 etc.

Thanks again for great job!

Re: HMG.3.4.2

Posted: Wed Oct 28, 2015 11:30 am
by Rathinagiri
You can press Alt+F9 to toggle always on top. You can use Alt +/- to make the debugging window transparent.

Re: HMG.3.4.2

Posted: Wed Oct 28, 2015 12:02 pm
by mol
Rathinagiri wrote:You can press Alt+F9 to toggle always on top. You can use Alt +/- to make the debugging window transparent.
Upsss... I dindn't know. Thanks for info!