Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keyboard shortcut to read memo fields
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00626354
Message ID:
00626375
Vues:
12
>Okay - I feel really stupid asking this - but...
>
>When I'm browsing a table with memo fields, I have to double click on the word "Memo" to see the contents of those fields. Is there a keyboard shortcut that does the same thing?
>
>Thanks.

The only way around I know of is this

(1) have your own edit box, with in the keypress
LPARAMETERS nKeyCode, nShiftAltCtrl

do case
case inlist(nKeyCode, nKEY_TAB, nKey_SHIFT_TAB)

case	!(this.Parent.BaseClass == 'Column')

otherwise && this.InGrid
	do case
	case ( (nShiftAltCtrl <= 1) )
		&& here we are in a grid
		NODEFAULT
		local c
		c = chr(nKeyCode)
		do case
		case nKeyCode = nKey_PAGE_DOWN
			=this.Parent.Parent.DoScroll(3)
			=this.Parent.Parent.SetFocus()
		case nKeyCode = nKey_PAGE_UP
			=this.Parent.Parent.DoScroll(2)
			=this.Parent.Parent.SetFocus()
		case nKeyCode = nKEY_LEFT_ARROW
			keyboard '{BACKTAB}'
		case inlist(nKeyCode, nKEY_RIGHT_ARROW, nKey_CR )
			*thisform.IgnoreNextChar = TRUE
			KeyBoard '{TAB}'
		case nKeyCode = nKEY_UP_ARROW
		
			if( !bof(this.Parent.Parent.RecordSource) )
				skip -1 in (this.Parent.Parent.RecordSource)
			endif
			
		case nKeyCode = nKEY_DOWN_ARROW
			if( !eof(this.Parent.Parent.RecordSource) )
				skip in (this.Parent.Parent.RecordSource)
			endif

		otherwise
			if( !empty(this.ControlSource) )
			
				push key
				on key label F7 keyboard '{CTRL+W}'
				on key label TAB keyboard '{CTRL+W}'
				if( IsRunTime() )
					on key label ENTER keyboard '{CTRL+W}'
				endif
				local _form
				_form = iif(type('thisform') == T_OBJECT, thisform.Name, 'screen')
				this.IgnoreFocus = TRUE
				if( this.ReadOnly )
					modify memo (this.ControlSource) NOEDIT NOMENU in (_form)
				else
					if( empty(this.Value) and !isblank(c) )
						KeyBoard c
					endif				
					modify memo (this.ControlSource) NOMENU in (_form)
				endif
				pop key
				
				this.ToolTipText = left(this.Value,127)
			endif
		endcase
	endcase
endcase
(2) instead of browse, do =brow()
procedure	Brow(AtEof)
	if( AtEof)
		go bott
		skip max(-22, -reccount() )
	endif
	local _w, i, x[1], _mask, _Fields, _Refresh
	_Fields = ''
	_Refresh = ''
	for m.i = 1 to afields(x)
		do case
		case	(x[m.i,2] == 'I') or (x[m.i,2] == 'N' and empty(x[m.i,4]) )
			_mask = '999,999,999'
		case	inlist(x[m.i,2], 'N', 'Y') and !empty(x[m.i,4])
			_mask = '999,999,999,999.' + padr('', x[m.i,4],'9')
		otherwise
			_mask = ''
		endcase
		
		_Fields = _Fields + iif(empty(_Fields), 'Fields ', ', ' ) ;
					+ x[m.i,1] + iif(empty(_mask), '', ':P = "' + _mask + '"')
	endfor
	
	if( inlist(Proper(alias()), 'Trans' ) )
		_Refresh = 'norefresh'
	endif

	browse &_Fields last name _w nowait &_Refresh normal ;
		in screen
	
	_w.Visible = .F.
	_w.GridLineColor = rgb(128,128,128)
	_w.RowHeight = 14
	_w.RecordMark = .F.
	_w.DeleteMark = .T.
	_w.SetAll('Fontsize', 8, 'Header')
	*_w.SetAll('FontBold', .F., 'Header')
	
	local t, obj
	for m.i = 1 to alen(x, 1)
		obj = _w.Columns[m.i]
		t = type(obj.ControlSource)
		do case
		case ( inlist(t, 'I', 'N', 'Y' ) )
			obj.DynamicForeColor = ;
				'iif(' + obj.ControlSource ;
					+ '<0,rgb(255,0,0),rgb(0,0,0))'
		case inlist(t, 'M')
			obj.RemoveObject('Text1')
			obj.AddObject('Text1', '_editbox')
			obj.Text1.Scrollbars = 0
			obj.Sparse = FALSE
			obj.Text1.Visible = TRUE
		case inlist(t, T_DATE, T_DATETIME )
			obj.Format = 'D'	&& 2 or 4 chars
		case inlist(t, T_LOGICAL )
			*obj.RemoveObject('Text1')
			*obj.AddObject('_Checkbox', 'Checkbox')
			*obj._Checkbox.Visible = TRUE
			*obj._CheckBox.BackStyle = 0
			obj._CheckBox.Caption = ''
			obj.Sparse = FALSE
		endcase
		if( !inlist(t, T_MEMO, T_LOGICAL ) )
			obj.Alignment = 3
		endif
	endfor
	
	
	_w.Setall('FontSize', 8)
	_w.Setall('BorderStyle', 0 )
	_w.Setall('Margin', 0)
	_w.backColor = rgb(192,192,192)
	*_w.SetAll('DynamicBackColor', 'rgb(192,192,192)')
	_w.Height = _w.Height + iif(empty(mod(_w.Height,2)), +1, -1)
	_w.Visible = .T.
	
endproc
*---------------------------------------------------------------------------
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform