CreateEllipticRgn / CreateRectRgn

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

User avatar
andyglezl
Posts: 1191
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 37 times
Been thanked: 85 times
Contact:

Re: CreateEllipticRgn / CreateRectRgn

Post by andyglezl » Tue Nov 19, 2019 3:11 pm

AUGE_OHR wrote:
Tue Nov 19, 2019 3:59 am
hi,

cIdx := STRZERO(nIDig,2)
cForm := "Form_" + cIdx // Form_01
cImage := "Image_"+cIdx // Image_01
SetProperty( "Form_" + cIdx, "Image_" + cIdx, 'Picture', a_Digit[nNr+1] )
but it does not change PICTURE :(

who can help me please.
Try this

SetProperty( cForm, cImage, 'Picture', a_Digit[nNr+1] )
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
AUGE_OHR
Posts: 290
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 32 times
Been thanked: 39 times

Post by AUGE_OHR » Tue Nov 26, 2019 7:43 am

hi,

thx for Hint, i have now use other Way.

i do not "attach" Image to Form, i just "paint" it into Form :D
i found Solution in c:\hmg.3.4.4\SAMPLES\Events\ON_PAINT\WALLPAPER\demo.prg

there is a HB_FUNC(BMP_PAINT) which use StretchBlt()
but Parameter are "fix" on full Image Size

Code: Select all

   0, 0, bm.bmWidth, bm.bmHeight
these lines i enhance for new Parameter

Code: Select all

   if (nMode == BMP_COPY_SPLIT)
   {
      rect.bottom = hb_parnl (6);
      rect.right  = hb_parnl (7);

      aSource.top    = hb_parnl (8);
      aSource.left   = hb_parnl (9);
      aSource.bottom = hb_parnl (10);
      aSource.right  = hb_parnl (11);

      StretchBlt(hDC, rect.left, rect.top, rect.right, rect.bottom, memDC, aSource.left, aSource.top, aSource.right, aSource.bottom, SRCCOPY);
   }
so my Code look now

Code: Select all

   hBitmap := BMP_LOAD_FILE("COLORS.BMP")
   wide    := BMP_GET_INFO (hBitmap, BMP_INFO_WIDTH)
   height  := BMP_GET_INFO (hBitmap, BMP_INFO_HEIGHT)

   FOR i = 1 TO iMax
      cForm  := "Form_"+strzero(i, 2)
      cOnPaintProc := "Paint_Background_Window( '" + cForm           + ;
                                                "', '" + str(i)      + ;
                                                "', '" + str(wide)   + ;
                                                "', '" + str(height) + ;
                                                "', '" + str(hBitmap)+ "'  )"
      DEFINE WINDOW &cForm ;
         ... 
         ON PAINT &cOnPaintProc ;
and painting

Code: Select all

FUNCTION Paint_Background_Window(cForm,cID,cwide,cheight,cBitmap)
LOCAL hWnd
LOCAL hBitmap
LOCAL nMode  := BMP_COPY_SPLIT
LOCAL Row    := 0
LOCAL Col    := 0
Local wide   := 32
Local height := 35
Local nPart  := 0

   nNo       := VAL(cID    )
   wide      := VAL(cwide  )
   height    := VAL(cheight)
   hBitmap   := VAL(cBitmap)
   nPart     := ROUND(wide/8,0)-1

   hWnd      := GetFormHandle(cForm)
   Row       := GetProperty(cForm ,"Height")
   Col       := GetProperty(cForm ,"Width" )

   BMP_PAINT (hWnd, hBitmap, nMode,0,0,Row,Col,;
                                   0,nPart*(nNo-1),height,nPart)

RETURN NIL
each Form now get "Part" of Bitmap paint into its Form so i do not need to "split" Bitmap any more

here new Version
HMG_UHR02.ZIP
(26.26 KiB) Downloaded 31 times
have fun

p.s. to close it look at TrayIcon lower right

User avatar
danielmaximiliano
Posts: 2178
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 183 times
Been thanked: 29 times
Contact:

Post by danielmaximiliano » Tue Nov 26, 2019 10:04 am

There are times when there are no answers because nobody had the need for some features you are using.
Master Claudio Soto is also not here since Bostaurus one of the great features of HMG is not participating lately.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
danielmaximiliano
Posts: 2178
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 183 times
Been thanked: 29 times
Contact:

Post by danielmaximiliano » Tue Nov 26, 2019 10:13 am

AUGE_OHR wrote:
Tue Nov 26, 2019 7:43 am

here new Version
HMG_UHR02.ZIP
have fun
Thank you, surely our friend and collaborator in Grigory Filatov will ask you for permission to add it to HMG Extended
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
bpd2000
Posts: 1101
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 203 times
Been thanked: 107 times

Post by bpd2000 » Tue Nov 26, 2019 11:36 am

AUGE_OHR wrote:
Tue Nov 26, 2019 7:43 am
here new Version
HMG_UHR02.ZIP
have fun
p.s. to close it look at TrayIcon lower right
Thank you for sharing, nice creation
BPD
Convert Dream into Reality through HMG

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

Post by serge_girard » Tue Nov 26, 2019 12:18 pm

Jimmy,

Where can I find DLL.ch?

Serge

User avatar
bpd2000
Posts: 1101
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 203 times
Been thanked: 107 times

Post by bpd2000 » Tue Nov 26, 2019 3:44 pm

serge_girard wrote:
Tue Nov 26, 2019 12:18 pm
Jimmy,

Where can I find DLL.ch?

Serge
Visit
https://github.com/vszakats/hb/blob/mas ... xpp/dll.ch
BPD
Convert Dream into Reality through HMG

User avatar
AUGE_OHR
Posts: 290
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 32 times
Been thanked: 39 times

Post by AUGE_OHR » Wed Nov 27, 2019 4:53 am

hi,
danielmaximiliano wrote:
Tue Nov 26, 2019 10:04 am
There are times when there are no answers because nobody had the need for some features you are using.
Master Claudio Soto is also not here since Bostaurus one of the great features of HMG is not participating lately.
it is true that my Question most are API Question but it is not the API itself it is how it work with HMG
even if i'm not a "C"-Guru i have less Problem to write a HB_FUNC than to understand how HMG / FMG work.

---

for my Demo i have use 8 x Form and ON PAINT. now i change to Label and wonder that it does not have ON PAINT :o
but every Control have WM_PAINT ... why under HMG only Form have that Event :?:

other are Syntax with "."

Code: Select all

   BMP_BAND1.Label_1.value := "ABC"   
list line work but

Code: Select all

   hWnd  := GETHWNDFROM(BMP_BAND1.Label_1)
fail with Syntax Error :( ... so how is the right Syntax to Get Handle of Control (not a API Question) :idea:

i guess i have to use a Macro for those Situation and that is what i want to find out before try a Big Application.

User avatar
bpd2000
Posts: 1101
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 203 times
Been thanked: 107 times

Post by bpd2000 » Wed Nov 27, 2019 10:05 am

AUGE_OHR wrote:
Wed Nov 27, 2019 4:53 am

Code: Select all

   BMP_BAND1.Label_1.value := "ABC"   
list line work but

Code: Select all

   hWnd  := GETHWNDFROM(BMP_BAND1.Label_1)
fail with Syntax Error :( ... so how is the right Syntax to Get Handle of Control (not a API Question) :idea:

i guess i have to use a Macro for those Situation and that is what i want to find out before try a Big Application.
Demo code for List of all defined controls in a form with Control handle

Code: Select all

# include "minigui.ch"

function main

define window sample at 0,0 width 800 height 600 title "List of all defined controls in a form" main 
   define label label1
      row 10
      col 10
      width 100
      value "Label 1"
   end  label
   define textbox text1
      row 10
      col 110
      width 120
      value "Sample Text Box 1"
   end textbox
   define label label2
      row 40
      col 10
      width 100
      value "Label 2"
   end  label
   define textbox text2
      row 40
      col 110
      width 120
      value "Sample Text Box 2"
   end textbox
   define label label3
      row 70
      col 10
      width 100
      value "Label 3"
   end  label
   define textbox text3
      row 70
      col 110
      width 120
      value "Sample Text Box 3"
   end textbox
   
   	@ 10,340 COMBOBOX Combo_1 ;
			ITEMS { 'A' , 'B' , 'C' } ;
			VALUE 1 ;
			DISPLAYEDIT ;
			ON DISPLAYCHANGE PlayBeep() 
			
   DEFINE HYPERLINK H1
			ROW		40
			COL		340
			VALUE		'http://www.hmgforum.com/' 
			FONTNAME	'Arial' 
			FONTSIZE	9 
			AUTOSIZE	.T. 
			ADDRESS		'http://www.hmgforum.com/'
			HANDCURSOR	.T.
		END HYPERLINK
 
		@ 80,340 DATEPICKER Date_1 ;
		VALUE CTOD('  / /  ') ;
		TOOLTIP 'DatePicker Control' 
   
   DEFINE STATUSBAR 
			STATUSITEM "Item 1" 	ACTION MsgInfo('Click! 1') RAISED 
			STATUSITEM "Item 2" 	WIDTH 100 ACTION MsgInfo('Click! 2') 
		
		END STATUSBAR
		
   define button action1
      row 100
      col 10
      width 100
      caption "Press here"
      action dolisting()
   end button
   define listbox list1
      row 130
      col 10
      width 300
      height 200
   end listbox
end window
sample.center
sample.activate
return nil


function dolisting
local aControls := GetWindowControls("sample")
local i := 0
sample.list1.deleteallitems()
for i := 1 to len(aControls)
   sample.list1.additem(aControls[i])
next i
if sample.list1.itemcount > 0
   sample.list1.value := 1
endif
return nil
//GETCONTROLTYPE( cFoco, cForm)
STATIC FUNCTION GetWindowControls(cForm)
local aControlList := {}, xx, yy
local i := 0

  aadd(aControlList,"MainFormName :" + hb_valtostr(GetMainFormName()))
  aadd(aControlList,"MainFormHandle :" + hb_valtostr(GetMainFormHandle()))
  aadd(aControlList,"Lis of Defined Control ")
  aadd(aControlList, "Cont.Type    Cont.Handle    Cont.Name" )
  aadd(aControlList, "----------------------------------------------")

for i := 1 to len(_HMG_SYSDATA[4])
   if _HMG_SYSDATA[4,i] == GetFormHandle(cForm)
      if len(alltrim(_HMG_SYSDATA [2] [i] )) > 0
      xx:= hb_Valtostr(GetControlHandle (_HMG_SYSDATA [2] [i],cForm))
      yy := GETCONTROLTYPE( _HMG_SYSDATA [2] [i], cForm)
         aadd(aControlList, yy +"  "+ xx + "  "+ HB_valtostr(_HMG_SYSDATA [2] [i] ))
      endif   
   endif
next i
return (aControlList)
BPD
Convert Dream into Reality through HMG

User avatar
AUGE_OHR
Posts: 290
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 32 times
Been thanked: 39 times

Post by AUGE_OHR » Wed Nov 27, 2019 6:20 pm

hi,
bpd2000 wrote:
Wed Nov 27, 2019 10:05 am
Demo code for List of all defined controls in a form with Control handle
THX for your Code, that look ggod :idea:

i saw _HMG_SYSDATA and found in c:\hmg.3.4.4\SOURCE\c_label.c / \hmg.3.4.4\SOURCE\h_label.prg

Code: Select all

Controlhandle := InitLabel ( ParentForm, Caption, 0, x, y, w, h, '', 0, Nil , border , clientedge , HSCROLL , VSCROLL , TRANSPARENT , invisible , rightalign , centeralign, EndEllipses, NoPrefix )
later i will be store to

Code: Select all

   _HMG_SYSDATA [1][k] := "LABEL" 
   _HMG_SYSDATA [2][k] := ControlName 
   _HMG_SYSDATA [3][k] := ControlHandle 
so my Question is : can i "hack" _HMG_SYSDATA [3][k] to get ControlHandle :?:

Code: Select all

   FOR n := 1 TO 8
      cLabel := "Label_"+LTRIM(STR(n))
      hWnd := GetControlHandle(cLabel)

Function GetControlHandle(cName)
LOCAL aName := ACLONE(_HMG_SYSDATA[2])
LOCAL nPosi := ASCAN(aName,{|e| e = cName } )
LOCAL nHwnd := 0
   IF nPosi > 0
      nHwnd := _HMG_SYSDATA [3][nPosi]
   ENDIF
RETURN nHwnd
this Way i seems to get ControlHandle but i don't know if it is "safe" :?:

Post Reply