Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptgetdndfetchindex.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptgetdndfetchindex.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptgetdndfetchindex.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptgetdndfetchindex.html on line 8
Search for an entry in the data_array for an incoming drag-and-drop event.
int PtGetDndFetchIndex(
const PtDndCallbackInfo_t * cbinfo,
const PtDndFetch_t * data_array,
unsigned array_size);
- dndcb
- A pointer to the drag-and-drop callback data.
- data_array
- A pointer to an array of transport types that the widget accepts in drag-and-drop events. For more information see PtDndFetch_t.
- array_size
- The number of items in data_array.
ph
This function determines if the drag-and-drop data from the event found in the PtDndCallbackInfo_t matches any of the transport types in the data_array.
- The index in the data_array for drag-and-drop event
- A match was found.
- -1
- No entry is found.
In this example, we determine the index in the data_array for the incoming drag-and-drop event:
PtDndCallbackInfo_t *dndcb = cbinfo->cbdata;
static PtDndFetch_t FetchTypes[] = {
{"PhTransfiles", NULL, Ph_TRANSPORT_INLINE, },
};
/*
* ARRAY_SIZE is defined as follows.
*/
#define ARRAY_SIZE ( m_array ) ( sizeof( m_array ) / sizeof( m_array[0] ) )
int
dnd_callback( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
switch( cbinfo->reason_subtype )
{
case Ph_EV_DND_ENTER:
num_matches = PtDndSelect( widget, FetchTypes, ARRAY_SIZE( FetchTypes ) )
break;
case Ph_EV_DND_DROP:
switch( PtGetDndFetchIndex( dndcb, FetchTypes, ARRAY_SIZE( FetchTypes ) ) )
{
case 0: //file
.
.
.
break;
}
.
.
.
break;
}
return( Pt_CONTINUE );
}
Photon
Safety: | |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
PtDndFetch_t,
PtDndSelect(),
PtInitDnd(),
PtReleaseTransportCtrl()
PtTransportCtrl_t,
PtTransportType()
Drag and Drop
chapter of the Photon Programmer's Guide
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptgetdndfetchindex.html on line 167
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptgetdndfetchindex.html on line 167