ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Forum AtoutFox : Re: detecter le click de la souris sur le header d'une colonne d'un grille   

Sujet

rss Flux RSS des derniers messages

Vous devez vous identifier pour pouvoir poser une question ou répondre.

mer. 24 janvier 2018, 12h06

FoxInCloud (Th. Nivelet)
France France

atoutfox.public.association

Re: detecter le click de la souris sur le header d'une colonne d'un grille

exemple :

procedure grd.Init()

local success;
, loGrc as Column;
laGrh[1], loGrh AS Header

* Delegate Header.Click() to a form-level method
success = aoClassCont(@m.laGrh, m.this'Header'.T.) > 0 && aoClassCont(): modify command abOOP (https://github.com/FoxInCloud/FoxInCloud-AB)
assert m.success
if m.success
  FOR EACH loGrh IN laGrh FOXOBJECT
    BindEvent(m.loGrh, 'Click', m.thisform'grhClick', 1)
  ENDFOR
endif

procedure thisForm.grhClick
lparameters lcTag; && parameters for programmatic grid order change only
, llAsc;
, llGOTOP;

IF m.thisForm.wlHTMLgen && FoxInCloud only
  return
endif

local llEvent;
laEvent[1];
, loGrh as Header;
, loSelect as abSelect;
, lcDesc;

llEvent = Empty(Pcount())
if m.llEvent
  AEvents(laEvent, 0) && 0 specifies that AEVENTS( ) returns a three-element array containing: 1- object reference to the current event source, 2- the name of the triggered event, 3- how the event was triggered.
  loGrh = m.laEvent[1]
  lcTag = Upper(JustField(Evl(m.loGrh.Parent.Tag, m.loGrh.Parent.ControlSource)))
endif

if lTag(m.lcTag, 'WebTemp')

  loSelect = abSelect('WebTemp'&& Descending() does not accept an alias as parameter
  lcDesc = Iif(Order() == m.lcTag AND Descending() or m.llAsc, 'ASCENDING''DESCENDING')

  set order to (m.lcTag) &lcDesc in WebTemp

  llGOTOP = lTrue(m.llGOTOP)
  if m.llGOTOP
    go top in WebTemp
  endif

  thisform.WebTempPageUpdate(;
    .T.&& do not refresh form
    )

  if m.llGOTOP
    go top in WebTemp_Page
  endif

  if m.llEvent
    loGrh.Parent.Parent.setFocus
  else
    thisForm.Refresh(.T..T..T..T.)
  endif
endif



Permalink : http://www.atoutfox.org/nntp.asp?ID=0000018814
20 087 messages dans le forum • Liste complète des messages

Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3