Fixed and enhanced SAMPLES

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
srvet_claudio
Posts: 1919
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 25 times
Been thanked: 96 times
Contact:

Re: Fixed and enhanced SAMPLES

Post by srvet_claudio » Sat Nov 19, 2016 3:46 am

Pablo, when I have time I make it.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com


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

Post by Pablo César » Sat Nov 19, 2016 12:49 pm

Ok Claudio. I understand.

Sorry to ak to you do... :oops:

The strange is accept to be BS_OWNERDRAW by initbutton and by changing style function but the button is not displaying. Exists, you can click where supose to be and works but not appears any button image. :|

I think need redraw button and to implement at event to keep its properties... :?

Searching at this msdn link https://msdn.microsoft.com/en-us/librar ... S.85).aspx
(most probably it's the same way of Grigory done in ODT_TAB)

The DRAWITEMSTUCT is what we will be using to color our buttons:

Code: Select all

typedef struct tagDRAWITEMSTRUCT {
	UINT CtlType;
	UINT CtlID;
	UINT itemID;
	UINT itemAction;
	UINT itemState;
	HWND hwndItem;
	HDC hDC;
	RECT rcItem;
	ULONG_PTR itemData;
} DRAWITEMSTRUCT;
I suppose that we need to make our own WM_DRAWITEM. So, after this, we have converted the lParam into our DRAWITEMSTRUCT, now all you have to do is color it.

Code: Select all

case WM_DRAWITEM:
	 {
		DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT*)lParam;
		return TRUE;
	 }
This is C++, but it could give an idea. In HMG Extended it's using OwnButtonPaint function (which I also included as comment).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

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

Post by Pablo César » Sat Nov 19, 2016 1:43 pm

Hi All,

Regarding USER_COMPONENTS in both examples, note we are not defining at demo prgs, this is doing by HMG calling i_UsrSOOP.ch file automactically. ;)

Very nice, doesn't It ? :)

Roberto left us a flexible way that allows the user to add components. I've never understood this availability as well as now. It's hard to understand a genius.

Thanks again, Roberto.

Image Image
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
srvet_claudio
Posts: 1919
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 25 times
Been thanked: 96 times
Contact:

Post by srvet_claudio » Sat Nov 19, 2016 4:53 pm

Pablo César wrote:Ok Claudio. I understand.

Sorry to ak to you do... :oops:

The strange is accept to be BS_OWNERDRAW by initbutton and by changing style function but the button is not displaying. Exists, you can click where supose to be and works but not appears any button image. :|

I think need redraw button and to implement at event to keep its properties... :?

Searching at this msdn link https://msdn.microsoft.com/en-us/librar ... S.85).aspx
(most probably it's the same way of Grigory done in ODT_TAB)

The DRAWITEMSTUCT is what we will be using to color our buttons:

Code: Select all

typedef struct tagDRAWITEMSTRUCT {
	UINT CtlType;
	UINT CtlID;
	UINT itemID;
	UINT itemAction;
	UINT itemState;
	HWND hwndItem;
	HDC hDC;
	RECT rcItem;
	ULONG_PTR itemData;
} DRAWITEMSTRUCT;
I suppose that we need to make our own WM_DRAWITEM. So, after this, we have converted the lParam into our DRAWITEMSTRUCT, now all you have to do is color it.

Code: Select all

case WM_DRAWITEM:
	 {
		DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT*)lParam;
		return TRUE;
	 }
This is C++, but it could give an idea. In HMG Extended it's using OwnButtonPaint function (which I also included as comment).
Button and Tab are examples of controls that have to be redrawn whole. That's why I do not like to implement them because it's like re-creating the UI.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

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

Post by Pablo César » Sat Nov 19, 2016 4:59 pm

Yes, I'm understanding Claudio.

But we can do it for USER_COMPONENTS proposes and with this we can encourage the user to create their own new controls instead.

As first example, the coloured TAB which many user liked. ;)

We can show the way and users have to do their part...

Rgds
USER_COMPONENTS was updated:
viewtopic.php?p=47854#p47854
Last edited by Pablo César on Wed Nov 23, 2016 2:01 am, edited 2 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

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

Post by Pablo César » Sun Nov 20, 2016 9:42 pm

Returning back "Print" which it were without any objective, now it can print the for thry internal HMG function PRINTWINDOW with PREVIEW optional.

So please be reconsidered as updated <HMG_Root_Folder>\include\i_UsrSOOP.ch file and updated USER_COMPONENTS pack for download it again with new options a main menu of Demo1.

See again previous mensage at:

viewtopic.php?p=47854#p47854
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

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

Post by Pablo César » Wed Nov 23, 2016 1:40 am

Hi Rathi and all,

I would like to add more one example for C:\hmg.3.4.3\SAMPLES\Advanced\USER_COMPONENTS.
Screen12.png
Screen12.png (36.5 KiB) Viewed 2417 times
This time some USER definition for HYPERLINKs and LABELs simulating hyperlink. This example contemplates chnging visual link color when be clicked (as normal browsers does) and address links now it could be for https, www, ErrorLog file (which is in html format), Word files by explorer association or any other document. Of course this example uses a differentiated i_UsrInit.ch file.

I've attached all files for your appreciation.

Hope everyone enjoys :P
Attachments
HyperLink.rar
Source files
(15.42 KiB) Downloaded 49 times
demo3_exe.rar
Executable file
(1.24 MiB) Downloaded 70 times
Last edited by Pablo César on Wed Mar 01, 2017 3:49 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

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

Post by Pablo César » Tue Nov 29, 2016 2:59 pm

Dear Rathi,

There is this folder C:\hmg.3.4.3\SAMPLES\Miscellaneous\PEDIDOS that it could be moved to inside of C:\hmg.3.4.3\SAMPLES\Applications.

Do you agree ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

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

Post by Pablo César » Wed Mar 01, 2017 1:47 pm

Hi Rathinagiri,

At D:\hmg.3.4.3\SAMPLES\HFCL\ComboSearchBox\DEMO_1\main.hbc and D:\hmg.3.4.3\SAMPLES\HFCL\ComboSearchBox\DEMO_2\main.hbc contain:
incpaths=c:\hmg.3.0.45\hfcl\include
libpaths=
libs=hfcl
gt=
mt=no
instpaths=
Which is not necessary any more and not path is not available in this version, correct ? The HBC file would be deleted.
Pablo César wrote:
Tue Nov 29, 2016 2:59 pm
Dear Rathi,

There is this folder C:\hmg.3.4.3\SAMPLES\Miscellaneous\PEDIDOS that it could be moved to inside of C:\hmg.3.4.3\SAMPLES\Applications.

Do you agree ?
No answer to me about it ? :oops:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply

Who is online

Users browsing this forum: lgcandia and 3 guests