RClick in ListBox

Post Reply
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

RClick in ListBox

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rafael,

Please review my suggestion at the spanish forum.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Post 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
Post Reply