SnM/SnM_Window.cpp
int GetSelectedAction(char* _section, int _secSize, int* _cmdId, char* _id, int _idSize, char* _desc, int _descSize)
{
	HWND hList = GetActionListBox(_section, _secSize);
	if (hList)
	{
		if (ListView_GetSelectedCount(hList))
		{
			LVITEM li;
			li.mask = LVIF_STATE | LVIF_PARAM;
			li.stateMask = LVIS_SELECTED;
			li.iSubItem = 0;
			for (int i=0; i < ListView_GetItemCount(hList); i++)
			{
				li.iItem = i;
				ListView_GetItem(hList, &li);
				if (li.state == LVIS_SELECTED)
				{
					int cmdId = (int)li.lParam;
					if (_cmdId) *_cmdId = cmdId;

					char actionName[SNM_MAX_ACTION_NAME_LEN] = "";
					ListView_GetItemText(hList, i, 1, actionName, SNM_MAX_ACTION_NAME_LEN); //JFB displaytodata? (ok: columns not re-orderable yet)
					if (_desc && _descSize > 0)
						lstrcpyn(_desc, actionName, _descSize);

					if (_id && _idSize > 0)
					{
						const char *custid=ReverseNamedCommandLookup(cmdId);
						if (custid) _snprintfStrict(_id, _idSize, "_%s", custid);
						else _snprintfStrict(_id, _idSize, "%d", cmdId);
					}
					return i;
				}
			}
		}
		else
			return -3;
	}
	return -1;
}
// returns the list view's selected item, or:
// -1 if the action wnd is not opened
// deprecated: -2 if the custom id cannot be retrieved (hidden column)
// -3 if there is no selected action
// note: no multi-selection mgmt here..

returns the list view's selected item, or:
1 if the action wnd is not opened
deprecated: -2 if the custom id cannot be retrieved (hidden column)
3 if there is no selected action
note: no multi-selection mgmt here
returns the list view ' s selected item or : 1 if the action wnd is not opened deprecated : - 2 if the custom id cannot be retrieved ( hidden column ) 3 if there is no selected action note : no multi - selection mgmt here
int GetSelectedAction(char* _section, int _secSize, int* _cmdId, char* _id, int _idSize, char* _desc, int _descSize)
{
	HWND hList = GetActionListBox(_section, _secSize);
	if (hList)
	{
		if (ListView_GetSelectedCount(hList))
		{
			LVITEM li;
			li.mask = LVIF_STATE | LVIF_PARAM;
			li.stateMask = LVIS_SELECTED;
			li.iSubItem = 0;
			for (int i=0; i < ListView_GetItemCount(hList); i++)
			{
				li.iItem = i;
				ListView_GetItem(hList, &li);
				if (li.state == LVIS_SELECTED)
				{
					int cmdId = (int)li.lParam;
					if (_cmdId) *_cmdId = cmdId;
					char actionName[SNM_MAX_ACTION_NAME_LEN] = "";
					ListView_GetItemText(hList, i, 1, actionName, SNM_MAX_ACTION_NAME_LEN); 
					if (_desc && _descSize > 0)
						lstrcpyn(_desc, actionName, _descSize);
					if (_id && _idSize > 0)
					{
						const char *custid=ReverseNamedCommandLookup(cmdId);
						if (custid) _snprintfStrict(_id, _idSize, "_%s", custid);
						else _snprintfStrict(_id, _idSize, "%d", cmdId);
					}
					return i;
				}
			}
		}
		else
			return -3;
	}
	return -1;
}
int GetSelectedAction ( char * _section , int _secSize , int * _cmdId , char * _id , int _idSize , char * _desc , int _descSize ) { HWND hList = GetActionListBox ( _section , _secSize ) ; if ( hList ) { if ( ListView_GetSelectedCount ( hList ) ) { LVITEM li ; li . mask = LVIF_STATE | LVIF_PARAM ; li . stateMask = LVIS_SELECTED ; li . iSubItem = 0 ; for ( int i = 0 ; i < ListView_GetItemCount ( hList ) ; i ++ ) { li . iItem = i ; ListView_GetItem ( hList , & li ) ; if ( li . state == LVIS_SELECTED ) { int cmdId = ( int ) li . lParam ; if ( _cmdId ) * _cmdId = cmdId ; char actionName [ SNM_MAX_ACTION_NAME_LEN ] = " " ; ListView_GetItemText ( hList , i , 1 , actionName , SNM_MAX_ACTION_NAME_LEN ) ; if ( _desc && _descSize > 0 ) lstrcpyn ( _desc , actionName , _descSize ) ; if ( _id && _idSize > 0 ) { const char * custid = ReverseNamedCommandLookup ( cmdId ) ; if ( custid ) _snprintfStrict ( _id , _idSize , " " , custid ) ; else _snprintfStrict ( _id , _idSize , " " , cmdId ) ; } return i ; } } } else return -3 ; } return -1 ; }
returns the list view's selected item, or:
1 if the action wnd is not opened
deprecated: -2 if the custom id cannot be retrieved (hidden column)
3 if there is no selected action
note: no multi-selection mgmt here..
returns the list view ' s selected item or : 1 if the action wnd is not opened deprecated : - 2 if the custom id cannot be retrieved ( hidden column ) 3 if there is no selected action note : no multi - selection mgmt here ..
//JFB displaytodata? (ok: columns not re-orderable yet)
