SDK Question Create drop down menu

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Hi all,

Can anyone help with creating a drop down "choice" menu like "TGT" in MapMfd.
Needs to be initialized from within a call like
Code:
InputTarget(void *id, char *str, void *user_data)
maybe (if that's the best way to do it).

Also, can
Code:
len = sprintf_s(buffer,"Base: %s",base);
skp->Text(90, 170, buffer,  len);
be made to print Upper Case only, no matter what case the user inputs?

Any help appreciated.

JMW
 
Last edited:

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,885
Reaction score
2,139
Points
203
Location
between the planets
Can anyone help with creating a drop down "choice" menu like "TGT" in MapMfd.

Unfortunately not, these menus are hardcoded and the API doesn't provide access to them. The only thing you can do is make an input box where the user can enter the name of the target.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,641
Reaction score
2,356
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
are you sure there? I remember the API changed in 2010...
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Got answer for Uppercase only -use
Code:
base = [B]_strupr[/B](base);

Still unable to find anything on creating drop down menu......... 2010 API ?:shifty:
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,641
Reaction score
2,356
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Got answer for Uppercase only -use
Code:
base = [B]_strupr[/B](base);
Still unable to find anything on creating drop down menu......... 2010 API ?:shifty:

Yes... I have seen it some while ago, there is an option for such menus. I'll search it after the dinner
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
Thanks Urwumpe - gotta go to airport, but will be back on later. :thumbup:
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,885
Reaction score
2,139
Points
203
Location
between the planets
are you sure there? I remember the API changed in 2010...

I needed it in a project for 2010, and I remember getting the same answer as I gave above when I asked for it. If I'm mistaken, I'd be very happy about it.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,641
Reaction score
2,356
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I needed it in a project for 2010, and I remember getting the same answer as I gave above when I asked for it. If I'm mistaken, I'd be very happy about it.

I just looked at it, there is the LISTENTRY structure, that represents exactly that, but I have not found any function that accepts this structure or an array of it.
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
611
Reaction score
52
Points
43
Location
Happy Wherever
This comes up in OrbiterAPI.h but I haven't got a clue how to use it! :facepalm:
Code:
 * \brief Entry specification for selection list entry.
 */
typedef struct {
	char name[64];   ///< entry string
	DWORD flag;      ///< entry flags
} LISTENTRY;

/**
 * \brief Callback function for list entry selections.
 */
typedef bool (*Listentry_clbk)(char *name, DWORD idx, DWORD flag, void *usrdata);

/**
 * \ingroup defines
 * \defgroup listentryflag
 * \sa LISTENTRY
 */
//@
#define LISTENTRY_SUBITEM   0x01  ///< list entry has subitems
#define LISTENTRY_INACTIVE  0x02  ///< list entry can not be selected
#define LISTENTRY_SEPARATOR 0x04  ///< entry is followed by a separator
//@

#define LIST_UPENTRY 0x01         ///< list has parent list

/**
 * \ingroup defines
 * \defgroup listclbkflag
 * \sa LISTENTRY
 */
//@
#define LISTCLBK_CANCEL     0x00  ///< user cancelled the selection list
#define LISTCLBK_SELECT     0x01  ///< user selected an item
#define LISTCLBK_SUBITEM    0x02  ///< user steps down to subitem
#define LISTCLBK_UPLIST     0x03  ///< user steps up to parent list
//@
:huh:
 
Last edited:

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
Don't know if it works in Orbiter2010, but FreeOrbitMFD included the source code - including how to access drop drown menus.

http://www.orbiter-forum.com/showthread.php?t=5100&highlight=KOST
I doesn't work for Orbiter 2010. When writing that addon cjp spent quite some time tracing the internal function calls in the Orbiter 2006 P1 binary so that he could call them from within the addon. Those function calls are specific to that particular binary so the code automatically detects if you are not using Orbiter 2006 P1 and reverts to the oapiOpenInputBox function.

True to form, cjp includes excellent documentation of his methods and source code with the addon, for anyone wishing to stand on his not-insignificant shoulders and repeat the exercise for Orbiter 2010 P1.
 
Top