Page 1 of 1

RClick in ListBox

Posted: Mon Oct 10, 2005 10:52 am
by Rafael Clemente
Anybody could give an example to solve the following problem:

I have a ListBox and would like that upon clicking the Right button on any line, that line becomes activated (blue). The idea is to open a PopUp menu to perform some actions on the contens of that line. Until now, I have to Lclik first to select the line and then RClick to open the menu. Surely must be some way to perform both actions at once.

Thanks

Rafael

Posted: Mon Oct 10, 2005 11:07 am
by Antonio Linares
Rafael,

Please review my suggestion at the spanish forum.

Posted: Mon Oct 10, 2005 2:00 pm
by Rafael Clemente
Antonio:
Tu sugerencia no parece funcionar. El primer RClick hace que el elemento seleccionado "siga" al cursor del ratón pero no se estabiliza. Aquí está el programa que he utilizado para probarlo (XP Prof + FWH/FWHX 2.6 May/2005), por si lo quieres verificar:

Code: Select all

#include "FiveWin.ch"
STATIC oWnd, oLbx, oSay
FUNCTION Main()
LOCAL  cLbx, cTxt := SPACE(10)

DEFINE WINDOW oWnd TITLE "Test bRClicked"
@ 1, 2 SAY oSay VAR cTxt COLOR CLR_BLACK, CLR_WHITE
@ 4, 2 LISTBOX oLbx VAR cLbx ;
       ITEMS {"Uno","Dos","Tres","Cuatro","Cinco","Seis","Siete","Ocho"};
       SIZE 200,100 OF oWnd
oLbx:bRClicked := {|nRow, nCol| Prueba(nRow, nCol)}
ACTIVATE WINDOW oWnd
RETURN NIL

FUNCTION Prueba(nRow, nCol)
oLbx:SendMsg(WM_LBUTTONDOWN, nRow, nCol)
oSay:VarPut(oLbx:VarGet()); oSay:Refresh()
RETURN NIL