(SOLVED) Problem with LB_GETTEXT for current line

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

(SOLVED) Problem with LB_GETTEXT for current line

Post by *SanskritFritz »

history.txt wrote:15.09.06 Added: Support for accessibility tools (e.g. for blind users) to main lists+separate tree+sync+CD-Tree, allows to retrieve current line via LB_GETTEXT
I can get any filename from the panel now using an arbitrary index, but I could not find a way to get the index of the selected or current file. I tried LB_GETCARETINDEX and LB_GETCURSEL, it seems to me, that both are not supported (TC returns 0). So how can I "retrieve current line via LB_GETTEXT" as promised?
Last edited by SanskritFritz on 2006-11-14, 10:57 UTC, edited 1 time in total.
I switched to Linux, bye and thanks for all the fish!
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2SanskritFritz
I cannot confirm this. It works fine here. Example:

Code: Select all

HWND listBox = getActiveListBox();
if (listBox)
{
  LRESULT r = SendMessage (listBox , LB_GETCURSEL, 0, 0);
  LRESULT l = SendMessage (listBox , LB_GETTEXTLEN, (WPARAM)r, 0);
  char* text = new char [l +1];
  SendMessage (window, LB_GETTEXT, (WPARAM)r, (LPARAM)text);
  MessageBox (hwnd, text, 0, MB_ICONINFORMATION);
  delete [] text;
}
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

So are we having an AutoHotkey problem? Or maybe I am doing something wrong, can you check please this code?

Code: Select all

LB_GETCURSEL = 0xF188
SendMessage LB_GETCURSEL, 0, 0, TMyListBox1, ahk_class TTOTAL_CMD
nResult := ErrorLevel
MsgBox %nResult%
I switched to Linux, bye and thanks for all the fish!
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

Code: Select all

msgbox % tcgetselection()


 TCGetSelection(panel=1)
 {
	if LB_GETTEXT=
	{
		LB_GETTEXT		= 0x189
		LB_GETCURSEL	= 0x188
		VarSetCapacity(sss, 512)
	}

	 SendMessage LB_GETCURSEL, 0 , 0,  TMyListBox%panel%  , ahk_class TTOTAL_CMD
	 SendMessage LB_GETTEXT, %errorlevel% , &sss,  TMyListBox%panel%  , ahk_class TTOTAL_CMD
	 return sss
 }
LB_COUNT doesn't work here
Habemus majkam!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

Oops, got it, my
LB_GETCURSEL = 0xF188
was wrong...
I switched to Linux, bye and thanks for all the fish!
Post Reply