Hi,
i am struggling a little bit with all type of windows that we can define in HMG.
Playing and testing already for 2 days. Looked at a lot of samples but ....
I have a program (>150K lines) that is already converted to HMGext since a few years but with a WVT console screen. It is time to update/rewrite the UI.
What i want is a main MDI screen with a upper toolbar and a toolbarwindow on the left on the screen with menu buttons in it. Like the UI in Outlook, Word, ....
What i tried, i declared a main mdi screen, but it is impossible to define a panel to reserve space on the left side for the main menu. You can only define mdi windows in a main mdi window. I could define a mdi window for this menu (on the left), update his coord in function of the main mdi but i can not hide, min/max,sys menus.
Window layout that i want :
+----------------------------------------------------+
| MAIN MDI |
+--------+------------------------------------------+
| | |
| B | +---------------------+ |
| U | | MDI CHILD | |
| T | +---------------------+ |
| T | | | |
| O | | | |
| N | | | |
| S | +---------------------+ |
| | |
+-------+-------------------------------------------+
Can someone give me some hints / idees.
Thanks
Hans
Window types, STANDARD, MAINMDI, MDI, MDICHILD, PANEL, ....
Moderator: Rathinagiri
Re: Window types, STANDARD, MAINMDI, MDI, MDICHILD, PANEL, ....
Quizá de esta forma...
*---------------------------------------
Maybe in this way ...
viewtopic.php?f=24&t=5714&p=55588&hilit ... dle#p55588
*---------------------------------------
Maybe in this way ...
viewtopic.php?f=24&t=5714&p=55588&hilit ... dle#p55588
Code: Select all
*/*_______________________________________________________________________________________________________*/
*/*[•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•]*/
*/*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*/
#include "hmg.ch"
#define LABEL_NAME 1
#define LABEL_HWND 2
MEMVAR _HMG_SYSDATA
FUNCTION Main()
LOCAL aLabel := { {"LABEL1", NIL}, {"LABEL2", NIL}, {"LABEL3", NIL}, {"LABEL4", NIL}, {"LABEL5", NIL} }
LOCAL n
nWidthWMain := GetDesktopWidth()
nHeightWMain := GetDesktopHeight()
DEFINE WINDOW MainForm;
WIDTH nWidthWMain;
HEIGHT nHeightWMain;
TITLE "Labels as buttons";
MAIN ;
ON GOTFOCUS MainFormOnGotFocus(aLabel)
// ************ OR TOOLBARWINDOW **************
DEFINE MAIN MENU OF MainForm
DEFINE POPUP "***** EL NOMBRE DE MI SISTEMA *****"
MENUITEM 'ACERCA DE . . .' ACTION ( MSGBOX( "Acerca de..." ) )
END POPUP
DEFINE POPUP "OPCIONES 1"
MENUITEM 'OPCIÓN 1' ACTION ( MSGBOX( "Hola" ) )
MENUITEM 'OPCIÓN 2' ACTION ( NIL )
MENUITEM 'OPCIÓN 3' ACTION ( NIL )
SEPARATOR
MENUITEM 'OPCIÓN 4' ACTION ( NIL )
MENUITEM 'OPCIÓN 5' ACTION ( NIL )
END POPUP
DEFINE POPUP "OPCIONES 2"
MENUITEM 'OPCIÓN 1' ACTION ( NIL )
MENUITEM 'OPCIÓN 2' ACTION ( NIL )
MENUITEM 'OPCIÓN 3' ACTION ( NIL )
SEPARATOR
MENUITEM 'OPCIÓN 4' ACTION ( NIL )
MENUITEM 'OPCIÓN 5' ACTION ( NIL )
END POPUP
DEFINE POPUP "OPCIONES 3"
MENUITEM 'OPCIÓN 1' ACTION ( NIL )
MENUITEM 'OPCIÓN 2' ACTION ( NIL )
MENUITEM 'OPCIÓN 3' ACTION ( NIL )
SEPARATOR
MENUITEM 'OPCIÓN 4' ACTION ( NIL )
MENUITEM 'OPCIÓN 5' ACTION ( NIL )
END POPUP
END MENU
//this labels can get focus and process keyboard/mouse messages
FOR n := 1 TO Len(aLabel)
DEFINE LABEL &(aLabel[n][LABEL_NAME])
ROW 10 + 55 * (n - 1)
COL 10
WIDTH 140
HEIGHT 45
VALUE "This is " + aLabel[n][LABEL_NAME]
ALIGNMENT Center
FONTCOLOR BLACK
END LABEL
aLabel[n][LABEL_HWND] := GetProperty("MainForm", aLabel[n][LABEL_NAME], "HANDLE")
HMG_ChangeWindowStyle(aLabel[n][LABEL_HWND], 0x00010200 /*WS_TABSTOP|SS_CENTERIMAGE*/, NIL, .F., .F.)
EventProcessAllHookMessage(EventCreate({ || LabelEventHandler(aLabel) }, aLabel[n][LABEL_HWND]), .T.)
NEXT
END WINDOW
SetFocus(aLabel[1][LABEL_HWND])
LabelSetBorder(aLabel, aLabel[1][LABEL_HWND])
MainForm.CENTER
MainForm.ACTIVATE
RETURN NIL
FUNCTION MainFormOnGotFocus(aLabel)
LOCAL n
FOR n := 1 TO Len(aLabel)
PostMessage(aLabel[n][LABEL_HWND], WM_MOUSELEAVE, 0, 0)
NEXT
RETURN NIL
FUNCTION LabelEventHandler(aLabel)
STATIC lTracking := .F.
LOCAL nHWnd := EventHWND()
LOCAL nMsg := EventMSG()
LOCAL nWParam := EventWPARAM()
LOCAL cControl
LOCAL cForm
GetControlNameByHandle(nHWnd, @cControl, @cForm)
SWITCH nMsg
CASE WM_KEYDOWN
IF nWParam == VK_TAB
LabelSetBorder(aLabel, GetNextDlgTabItem(MainForm.HANDLE, nHWnd, (GetKeyState(VK_SHIFT) < 0)))
ELSEIF (nWParam == VK_RETURN) .or. (nWParam == VK_SPACE)
MsgBox(GetProperty(cForm, cControl, "VALUE"))
ENDIF
EXIT
CASE WM_KEYUP
IF nWParam == VK_TAB
LabelSetBorder(aLabel, nHWnd)
ENDIF
EXIT
CASE WM_LBUTTONDOWN
SetFocus(nHWnd)
LabelSetBorder(aLabel, nHWnd)
MsgBox(GetProperty(cForm, cControl, "VALUE"))
EXIT
CASE WM_RBUTTONDOWN
SetFocus(nHWnd)
LabelSetBorder(aLabel, nHWnd)
EXIT
CASE WM_MOUSEMOVE
IF ! lTracking
SetProperty(cForm, cControl, "FONTCOLOR", MAGENTA )
SetProperty(cForm, cControl, "FONTBOLD", .T.)
lTracking := TrackMouseEvent(nHWnd) //TME_LEAVE is default flag
ENDIF
EXIT
CASE WM_MOUSELEAVE
SetProperty(cForm, cControl, "FONTCOLOR", GRAY )
SetProperty(cForm, cControl, "FONTBOLD", .F.)
lTracking := .F.
EXIT
ENDSWITCH
RETURN NIL
FUNCTION LabelSetBorder(aLabel, nHWnd)
LOCAL nPos := aScan(aLabel, { |a1| nHWnd == a1[LABEL_HWND] })
LOCAL n
FOR n := 1 TO Len(aLabel)
HMG_ChangeWindowStyle(aLabel[n][LABEL_HWND], NIL, 0x00800000 /*WS_BORDER*/, .F., .T.)
HMG_ChangeWindowStyle(aLabel[n][LABEL_HWND], 0x00020000 /*WS_EX_STATICEDGE*/, NIL, .T., .T.)
NEXT
IF nPos > 0
HMG_ChangeWindowStyle(aLabel[nPos][LABEL_HWND], 0x00800000 /*WS_BORDER*/, NIL, .F., .T.)
HMG_ChangeWindowStyle(aLabel[nPos][LABEL_HWND], NIL, 0x00020000 /*WS_EX_STATICEDGE*/, .T., .T.)
ENDIF
RETURN NIL
#pragma BEGINDUMP
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"
#include <windows.h>
#include "hbapi.h"
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms646265(v=vs.85).aspx
// TrackMouseEvent(nHWnd, [nFlags], [nHoverTime]) --> lSuccess
HB_FUNC( TRACKMOUSEEVENT )
{
TRACKMOUSEEVENT tmi;
tmi.cbSize = sizeof(TRACKMOUSEEVENT);
tmi.dwFlags = hb_parnidef(2, TME_LEAVE);
tmi.hwndTrack = (HWND) HMG_parnl(1);
tmi.dwHoverTime = hb_parnidef(3, HOVER_DEFAULT);
hb_retl(TrackMouseEvent(&tmi));
}
#pragma ENDDUMP
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: Window types, STANDARD, MAINMDI, MDI, MDICHILD, PANEL, ....
Nice sample!
I've created left-side menu in the same way half year ago
I've created left-side menu in the same way half year ago
Re: Window types, STANDARD, MAINMDI, MDI, MDICHILD, PANEL, ....
Thanks. Compiling i have the next error
Date:05/15/19 Time: 11:03:58
Error BASE/1003 Variable does not exist: MAGENTA
Called from LABELEVENTHANDLER(135)
Called from (b)MAIN(75)
Called from EVENTPROCESS(155)
Called from DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(5717)
Called from DOMETHOD(9003)
Called from MAIN(84)
Date:05/15/19 Time: 11:03:58
Error BASE/1003 Variable does not exist: MAGENTA
Called from LABELEVENTHANDLER(135)
Called from (b)MAIN(75)
Called from EVENTPROCESS(155)
Called from DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(5717)
Called from DOMETHOD(9003)
Called from MAIN(84)
- mustafa
- Posts: 1158
- Joined: Fri Mar 20, 2009 11:38 am
- DBs Used: DBF
- Location: Alicante - Spain
- Contact:
Re: Window types, STANDARD, MAINMDI, MDI, MDICHILD, PANEL, ....
FUNCTION LabelEventHandler(aLabel)
STATIC lTracking := .F.
LOCAL nHWnd := EventHWND()
LOCAL nMsg := EventMSG()
LOCAL nWParam := EventWPARAM()
LOCAL cControl
LOCAL cForm
LOCAL MAGENTA := { 230,000,126 } // <------------- Add this in code
GetControlNameByHandle(nHWnd, @cControl, @cForm)
etc ... etc...
STATIC lTracking := .F.
LOCAL nHWnd := EventHWND()
LOCAL nMsg := EventMSG()
LOCAL nWParam := EventWPARAM()
LOCAL cControl
LOCAL cForm
LOCAL MAGENTA := { 230,000,126 } // <------------- Add this in code
GetControlNameByHandle(nHWnd, @cControl, @cForm)
etc ... etc...
Re: Window types, STANDARD, MAINMDI, MDI, MDICHILD, PANEL, ....
Lo siento, yo modifiqué el i_color.ch a mi necesidad
remplazalo con FUCHSIA u otro color a tu gusto.
*-------------------------------------------------------------------
Sorry, I modified the i_color.ch to my need
Replace it with FUCSIA and another color to your liking
remplazalo con FUCHSIA u otro color a tu gusto.
*-------------------------------------------------------------------
Sorry, I modified the i_color.ch to my need
Replace it with FUCSIA and another color to your liking
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.