some wishes

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

Post Reply
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

some wishes

Post by dragancesu »

Excellent software, great forum

It is difficult to look for something that does not have, but when it comes to still get to hear ideas and desires

Menu:
1 that you can increase the font size in the menu, it is a question of user
2 that the item menus can highlight like bold, italic

Database access:
1 harbour HMG and work nicely with DBF, Sqlite and MySQL (MSSQL/Access do not use, do not know)
2 harbour works with Oracle and PostgreSQL, HMG does not work, I think something is not well integrated / inclusive
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: some wishes

Post by mol »

I will add few wishes:
1. When I use On Key ESCAPE.... to release form and I activate main or context menu, the form is released. The natural way is to leave menu. It should be possibility to test if menu is active.
2. Context menu called by keyboard is always activate at the right bottom corner of desktop - when I'm working with two displays - my app is on first screen, but menu at the second
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: some wishes

Post by mol »

I found solution for detecting Context Menu.

Maybe it's not elegant now, but, I don't know how to get value of public variable from C code, so my scenario is:
1. declare public variable - in my sample it's Public nContextMenuIsActive := 0
2. Modified function NEW_TrackPopupMenu with added 5th parameter - my public variable nContextMenuIsActive passed by reference.
3. This new function set nContextMenuIsActive to value 999 ( it should be logical value - 999 is for test) and calls original TrackPopupMenu
4. After releasing context menu, Public nContextMenuIsActive has to be set to 0.


Modified context menu is called by simply left-clicking label!



Look at this sample code:

Code: Select all

/*
 2016.05.10 Marek Olszewski MOL 
Detection of Context Menu sample
*/


#include "hmg.ch"

Function Main

	Public nContextMenuIsActive := 0
	
	DEFINE WINDOW Context ;
        AT 0,0 ;
        WIDTH 600 HEIGHT 600 ;
        TITLE 'Context Menu Test' ;
		Main  
		
		DEFINE CONTEXT MENU
			MENUITEM "Item 1" ACTION MsgInfo("Item 1")
			MENUITEM "Item 2" ACTION MsgInfo("Item 2")
			MENUITEM "Item 3" ACTION MsgInfo("Item 3")
		END MENU
	
		DEFINE LABEL Label_2
			ROW    220
			COL    180
			WIDTH  190
			HEIGHT 30
			VALUE "Click to activate New Context Menu Test"
			FONTNAME "Arial"
			FONTSIZE 9
			ACTION CallNewContextMenu()
		END LABEL
	END WINDOW
	
	ON KEY ESCAPE OF CONTEXT ACTION DO_RELEASE()
	
	Activate Window Context

Return

*--------------------

FUNCTION DO_RELEASE
	
	MsgDebug("nContextMenuIsActive",nContextMenuIsActive)
	
	if nContextMenuIsActive <> 0
		MsgInfo("Context menu is activated!!!")
	else
		if MsgYesNo("Close application?")
			Context.Release
		endif
	endif
	
 return
*--------------------
function CallNewContextMenu()
	local i
	i := GetFormIndex ( "Context" )
	xContextMenuHandle := _HMG_SYSDATA [ 74 ][i]
	//xFormHandle := _HMG_SYSDATA [ 67 ] [i]
	
	xFormHandle := Context.Handle
	
	NEW_TrackPopupMenu ( xContextMenuHandle  , 400 , 400 , xFormHandle, @nContextMenuIsActive )
return


*------------------- 
#pragma BEGINDUMP
#include "windows.h"
#include <hbapi.h>

   #define HMG_parnl         hb_parnl
   #define HMG_parvnl        hb_parvnl
   #define HMG_retnl         hb_retnl
   #define HMG_retnllen      hb_retnllen
   #define HMG_stornl        hb_stornl
   #define HMG_storvnl       hb_storvnl
   #define HMG_arraySetNL    hb_arraySetNL
   #define HMG_arrayGetNL    hb_arrayGetNL

 HB_FUNC ( NEW_TRACKPOPUPMENU )
{
   HWND hWnd = (HWND) HMG_parnl (4);
   
   SetForegroundWindow( hWnd );

   BOOL lTopMost = HMG_IsWindowStyle( hWnd, WS_EX_TOPMOST, TRUE );
 
   if( lTopMost )   // ADD September 2015
      SetWindowPos( hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE );
   
   // Marek Olszewski MOL 2016.05.10 added one line to set 5th parameter
   hb_storni(999,5);
   
   TrackPopupMenu ( (HMENU) HMG_parnl(1), TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON, hb_parni(2), hb_parni(3), 0, hWnd, NULL );
   
   // Marek Olszewski MOL 2016.05.10 added one line to set 5th parameter
   hb_storni(0,5);
   
   if( lTopMost )   // ADD September 2015
      SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE );

// PostMessage( hWnd, WM_NULL, 0, 0 );
}

#pragma ENDDUMP
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: some wishes

Post by mol »

Hi guys!
Do somebody know how can I access Public variable or Public array element from C level?
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: some wishes

Post by mol »

mol wrote:Hi guys!
Do somebody know how can I access Public variable or Public array element from C level?
Someone can help me?
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: some wishes

Post by andyglezl »

Desconozco "C", pero si le pasas como parametro el valor ???
---------------------------------------------------------------------------
I do not know "C", but if you pass it as a parameter the value ???

Code: Select all

If capGetDriverDescription(i, @cDriverName, 128, @cDriverVersion, 128)
          webcam.Combo_1.AddItem(cDriverName)
EndIf
.
.
.
-------------------------------------------------------------

	HB_FUNC( CAPGETDRIVERDESCRIPTION )
    {
        TCHAR lpszName[128];
        int iName = hb_parni(3);
        TCHAR lpszVer[128];
        int iVer = hb_parni(5);
        BOOL bRet;

        bRet = capGetDriverDescription( (WORD) hb_parnl(1), lpszName, iName, lpszVer, iVer );

        hb_storc( lpszName, 2 );
        hb_storc( lpszVer, 4 );

        hb_retl( bRet );
    }
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: some wishes

Post by mol »

My idea is to define something like this:
cForm.IsMainMenuActive
and switch this value before activation menu and after release.
Such solution requires minimum change of source code
Post Reply