Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUGS: Pageframe and Page.Deactivate NODEFAULT
Message
 
 
To
03/07/2005 04:12:03
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01028103
Message ID:
01028631
Views:
19
>>1) How do you solve the problem of not doing your code if the user clicks on the same page?
>>
>>2) What if your form's baseclass already has code in KeyPress? How can you add your new code? If you would call dodefault in KeyPress, it would fire key sequence twice, would it?
>>
>>Thanks.
>
>
>Nadya,
>
>(1) I don't. I have not found a way. If you click on the page header of the page you are on then the deactivate fires
>

Aha! I knew it! It is not an easy problem. I thought I solved it by a very tricky idea, but it turned to be unreliable. My idea was to add (and then remove) an option button in the pageframe init with the same caption as page's and fonts, etc. with AutoSize to determine the width of the page (start and end position), then save coordinates in MouseDown of the pageframe and compare it with the start and and posiiton of the page. It seems to work very well, but I think, there is slight difference between page tab and an option button, because for a small caption of 2 letters only I seem to miscalculate. Also it's unclear, how to handle hot-keys using this approach.

So, I decided to leave this bug until me (or Fabio) design a pageframe replacement...


>(2) the code above is in my form's base class. It prevents switching pages with Left|Right arrow on all pageframes
>
>All forms derived from my form's baseclass call the Dodefault().
>The code in the form's baseclass' Keypress returns TRUE if it handled the keystroke, FALSE if it did not
>
>&& Excerpt of code in form's baseclass
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>
>&& returns TRUE if char processed here
>
>do case
>case inlist(nKeyCode, nKEY_LEFT_ARROW, nKEY_RIGHT_ARROW)
>	local ac
>	ac = this.GetActiveControl()
>	if( !isNull(ac) )
>		if( ac.BaseClass = 'Page' )
>			NODEFAULT
>			return TRUE
>		endif
>	endif
>	
>case ...	
>
>endcase
>
>&& if we get here, then the char has not been processed here
>&& hence
>return FALSE
>
>
>So, the keypress of any form looks like this
>
>LPARAMETERS nkeycode,nshiftaltctrl
>
>if( DoDefault(m.nkeycode, m.nshiftaltctrl) )
>	return TRUE
>endif
>	
>&& code specific to the form below
>do case
>case	m.nshiftaltctrl = 0
>	do case
>	case inlist(m.nKeyCode, nKey_F7)
>		NODEFAULT
>		
>	endcase
>
>endcase
>
In my case it's the other way around. E.g. in our base form class we have some code in KeyPress (AFAIK only for ESC). I created my own subclass called DataEntry. How would I incorporate your code and preserve baseclass' code?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform