Deactivation of main or context menu

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Deactivation of main or context menu

Post by Roberto Lopez »

gfilatov wrote: The Marek's sample works fine after these changes:

Code: Select all

...
   On Key ESCAPE OF Second Action ( IIF(Empty(EndMenu()), NIL, Second.Release) )
...
It seems that Windows API EndMenu() function is not
available at the Win9x :o
I've changed on Key code processing to do this automatically, so, it will simply work transparently from Marek's code POV.

But, there is some bad news...

In fact, there is another problem exposed by Marek's code. This problem is not related with menu or On Key processing.

The problem is the following: If you call a Msg* function, exiting from the dialog with Esc. and your attempts to close Msg* parent via 'Release' method immediately after this, the 'Release' method fails with no error message, it is simply ignored. I'm working on that.

Regarding availability of EndMenu() in 9x, you could try WM_CANCELMODE message (http://msdn.microsoft.com/en-us/library ... S.85).aspx)

Anyway, I guess that it's time to drop Win9x support for future HMG versions. Win9x machines are near to the end of its lives.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
gfilatov
Posts: 1057
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Deactivation of main or context menu

Post by gfilatov »

Roberto Lopez wrote: I've changed on Key code processing to do this automatically, so, it will simply work transparently from Marek's code POV.
...
Sure. I guess that your code in h_windows.prg is similar as below :arrow:

Code: Select all

        ***********************************************************************	
        case nMsg == WM_HOTKEY
        ***********************************************************************

		* Process HotKeys

		i := Ascan ( _HMG_SYSDATA [  5 ] , wParam )

		If i > 0

			If _HMG_SYSDATA [1] [i] = "HOTKEY" .And. _HMG_SYSDATA [4][i] == GetActiveWIndow()

				If _HMG_SYSDATA [ 8 ] [i] == VK_ESCAPE
					If Empty( EndMenu() )
						Return 0
					EndIf
				EndIf

				If _DoControlEventProcedure ( _HMG_SYSDATA [  6 ] [i] , i )
					Return 0
				EndIf

			EndIf

		EndIf
...
Just idea :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Deactivation of main or context menu

Post by Roberto Lopez »

gfilatov wrote:
Roberto Lopez wrote: I've changed on Key code processing to do this automatically, so, it will simply work transparently from Marek's code POV.
...
Sure. I guess that your code in h_windows.prg is similar as below :arrow:

Code: Select all

        ***********************************************************************	
        case nMsg == WM_HOTKEY
        ***********************************************************************

		* Process HotKeys

		i := Ascan ( _HMG_SYSDATA [  5 ] , wParam )

		If i > 0

			If _HMG_SYSDATA [1] [i] = "HOTKEY" .And. _HMG_SYSDATA [4][i] == GetActiveWIndow()

				If _HMG_SYSDATA [ 8 ] [i] == VK_ESCAPE
					If Empty( EndMenu() )
						Return 0
					EndIf
				EndIf

				If _DoControlEventProcedure ( _HMG_SYSDATA [  6 ] [i] , i )
					Return 0
				EndIf

			EndIf

		EndIf
...
Just idea :idea:
Almost, but I've done _DoControlEventProcedure unconditionally processed.

Perhaps, you are right and the first Escape should close menu only and to not process Esc. user action procedure... I'm not sure... I'll think on that...
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: Deactivation of main or context menu

Post by Czarny_Pijar »

Roberto Lopez wrote:Perhaps, you are right and the first Escape should close menu only and to not process Esc. user action procedure... I'm not sure... I'll think on that...
If I can vote here : Single HotKey = Single Action, no combos, please. It cost next to nothing to press the Esc key twice.
Alex Gustow wrote: At present about 30% (!! I'm shocking too :shock: ) of computers in our district's hospitals are "old and slow" and XP (or 7) can't run on that "ancients"... but Win98 runs OK;
Don't be sad! I can show you some of my clients still happy with DOS5/DOS6.2 connected to Novell3.12. Surprisingly, they do not want anything else, even if the old machine breaks down and must replace it with another of modern machine. Now my efforts are commited to slowdown these speed demons - disabling all caches is a must ;)
Alex Gustow wrote:So (it's only my opinion) it's not yet time "to drop Win9x support for future HMG versions"... I understand that such support is a bigger and bigger problem for HMG developers (for you at first) and programmers who uses HMG... Maybe some later?..
The decision is really tough: To leave the Win9x users? To sacrifice the new possibilities? If both 'no' then what? Split the HMG into 9x-compatble and XP-and-next divisions? Happily I do not have to answer such questions. :)
Last edited by Czarny_Pijar on Thu Apr 29, 2010 5:22 pm, edited 1 time in total.
User avatar
Alex Gustow
Posts: 290
Joined: Thu Dec 04, 2008 1:05 pm
Location: Yekaterinburg, Russia
Contact:

Re: Deactivation of main or context menu

Post by Alex Gustow »

Roberto Lopez wrote:Anyway, I guess that it's time to drop Win9x support for future HMG versions. Win9x machines are near to the end of its lives.
I'm not fully agree with you, Roberto (but maybe I'm wrong :? ).

Let me explain my view... At present about 30% (!! I'm shocking too :shock: ) of computers in our district's hospitals are "old and slow" and XP (or 7) can't run on that "ancients"... but Win98 runs OK; and lot of "ancient" software - Office97, Foxpro for DOS, Clipper apps (and Harbour/HMG apps [created by me] of course! ;) ) etc. - runs very well till now... and (as users said) "it works? we can execute our everyday tasks? we can input data about patients - and output various reports?.. it's fully enough for us! we haven't money for noneeded new toys..."

So (it's only my opinion) it's not yet time "to drop Win9x support for future HMG versions"... I understand that such support is a bigger and bigger problem for HMG developers (for you at first) and programmers who uses HMG... Maybe some later?.. But it's only your decision as "HMG father" :)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Deactivation of main or context menu

Post by Roberto Lopez »

Alex Gustow wrote:
Roberto Lopez wrote:Anyway, I guess that it's time to drop Win9x support for future HMG versions. Win9x machines are near to the end of its lives.
I'm not fully agree with you, Roberto (but maybe I'm wrong :? ).

Let me explain my view... At present about 30% (!! I'm shocking too :shock: ) of computers in our district's hospitals are "old and slow" and XP (or 7) can't run on that "ancients"... but Win98 runs OK; and lot of "ancient" software - Office97, Foxpro for DOS, Clipper apps (and Harbour/HMG apps [created by me] of course! ;) ) etc. - runs very well till now... and (as users said) "it works? we can execute our everyday tasks? we can input data about patients - and output various reports?.. it's fully enough for us! we haven't money for noneeded new toys..."

So (it's only my opinion) it's not yet time "to drop Win9x support for future HMG versions"... I understand that such support is a bigger and bigger problem for HMG developers (for you at first) and programmers who uses HMG... Maybe some later?.. But it's only your decision as "HMG father" :)
Alex,

One of my customers has a PII with Win98 working as a POS with an HMG application written by me, so, I understand you situation perfectly.

I've was talking about this issue specifically, since I'm afraid that there is no so much alternatives here (I must test WM_CANCELMODE message (9x compatible?) yet).

Anyway, with 'drop 9x', I've was thinking on things that will be ignored by 9x systems without impeding the application to work.

Moreover, MSDN had changed minimum requirements for most API calls to 'Windows XP' so, it's very difficult to know what things TRULY requires Win XP.

The solution here is simply test a demo application containing the fix (available from 3.0.32) on a 9x machine.

Anyway, the end is near :)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Deactivation of main or context menu

Post by Roberto Lopez »

Czarny_Pijar wrote:
Roberto Lopez wrote:Perhaps, you are right and the first Escape should close menu only and to not process Esc. user action procedure... I'm not sure... I'll think on that...
If I can vote here : Single HotKey = Single Action, no combos, please. It cost next to nothing to press the Esc key twice.
We should think about it a little more...

If you define <Esc> key to close a window, perhaps, the fact that a popup menu be visible be irrelevant and that the window must close anyway without a double <Esc>, the right solution.

So, the 'single action' could be 'close the window' without care about the menu state.
Czarny_Pijar wrote: The decision is really tough: To leave the Win9x users? To sacrifice the new possibilities? If both 'no' then what? Split the HMG into 9x-compatble and XP-and-next divisions? Happily I do not have to answer such questions. :)
Perhaps, we should only to wait. The time is on our side. Sooner or later Win9x will disappear. Every day we are a step closer to that...

Moreover, the 'Split' is already in place. HMG 2.x is still there. It uses MingW 3.x, Harbour 1.x and code fully compliant with Win 9x. It works fine in slow machines.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
PeteWG
Posts: 176
Joined: Sun Mar 21, 2010 5:45 pm

Re: Deactivation of main or context menu

Post by PeteWG »

Czarny_Pijar wrote:
Alex Gustow wrote: At present about 30% (!! I'm shocking too :shock: ) of computers in our district's hospitals are "old and slow" and XP (or 7) can't run on that "ancients"... but Win98 runs OK;
Don't be sad! I can show you some of my clients still happy with DOS5/DOS6.2 connected to Novell3.12. Surprisingly, they do not want anything else, even if the old machine breaks down and must replace it with another of modern machine. Now my efforts are commited to slowdown these speed demons - disabling all caches is a must ;)
Alex Gustow wrote:So (it's only my opinion) it's not yet time "to drop Win9x support for future HMG versions"... I understand that such support is a bigger and bigger problem for HMG developers (for you at first) and programmers who uses HMG... Maybe some later?..
The decision is really tough: To leave the Win9x users? To sacrifice the new possibilities? If both 'no' then what? Split the HMG into 9x-compatble and XP-and-next divisions? Happily I do not have to answer such questions. :)
Hi Czarny_Pijar,

Please let me understand: Are you commenting/answering to Alex Gustov's message, 3 minutes *before* Alex publish his message?
This is a kind of quantization of the forum. How do you do that? 8-)

---
Pete
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Deactivation of main or context menu

Post by Roberto Lopez »

Roberto Lopez wrote: The problem is the following: If you call a Msg* function, exiting from the dialog with Esc. and your attempts to close Msg* parent via 'Release' method immediately after this, the 'Release' method fails with no error message, it is simply ignored. I'm working on that.
Grigory,

Not all MessageBox styles process Esc key.

According MSDN Esc key should be functional only when the MessageBox window has a <cancel> button, but this is not true.

The bottom line is that MessageBoxes processing Esc key will make SC_CLOSE (WM_SYSCOMMAND) message useless to close a window.

Have you any clue about this?

I'll still researching...
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: Deactivation of main or context menu

Post by Czarny_Pijar »

Roberto Lopez wrote:We should think about it a little more...

If you define <Esc> key to close a window, perhaps, the fact that a popup menu be visible be irrelevant and that the window must close anyway without a double <Esc>, the right solution.
Imagine this situation: The seller counted the whole shopping cart, now he wants to print the bill, therefore he has moved to the menu. Suddenly the customer wants one more chewing gum for the child ... Do you start with the whole bill from the beginning?
PeteWG wrote:Hi Czarny_Pijar,

Please let me understand: Are you commenting/answering to Alex Gustov's message, 3 minutes *before* Alex publish his message?
This is a kind of quantization of the forum. How do you do that? 8-)

---
Pete
That was quite easy: I've just edited my previous post, in order not to clutter this forum to much :roll:
PS
Hurray! The post number 10.000 is mine! :lol:
Post Reply