>You should be invoking the Dialogs::show member function to
>pop up the dialog. If you press the button to launch the dialog,
>then an InsetLabel pointer is passed to the function. On return
>from the dialog ("Apply") the global dispatch() interrogates the
>Dialogs class: "has any particular inset got an open dialog?"
>
>Here are the two functions:
>
>class Dialogs {
>pulic:
> /** \param name == "bibtex", "citation" etc; an identifier used to
> launch a particular dialog.
> \param data is a string representation of the Inset contents.
> It is often little more than the output from Inset::write.
> It is passed to, and parsed by, the frontend dialog.
> \param inset is _not_ passed to the frontend dialog.
> It is stored internally and used by the kernel to ascertain
> what to do with the FuncRequest dispatched from the frontend
> dialog on 'Apply'; should it be used to create a new inset at
> the current cursor position or modify an existing, 'open' inset?
> */
> void show(std::string const & name, std::string const & data,
> InsetBase * inset);
> ///
> InsetBase * getOpenInset(std::string const & name) const;
>
>};
>
>> LyXFunc::dispatch: cmd: action: 236 arg: 'label LatexCommand
>> \label{abc}
>> \end_inset
>> ' x: 0 y: 0
>>
>> LCursor::dispatch:
>>
>> trying to dispatch to main text 0x08b00ce8
>> LyXText::dispatch: cmd: action: 236 arg: 'label LatexCommand
>> \label{abc}
>> \end_inset
>> ' x: 0 y: 0
>> INSET APPLY name:label
>> APPLY: no inset
>
>So, presumably this means that Dialogs::getOpenInset is returning 0?
>
>> It's the "APPLY: no inset" message I don't understand. There IS an
>> inset and it should be found, shouldn't it?
>
>Only if Dialogs::show is being passed an inset in the first place.
>In your case, I think tht you shouldn't be creating the inset before
>calling Dialogs::show...
I see. But show is called when inserting the label inset:
1523 case LFUN_INSERT_LABEL: {
1524 doInsertInset(this, cmd, true, false);
1525 InsetCommandParams p("label");
1526 string const data = InsetCommandMailer::params2string("label", p);
1527 bv->owner()->getDialogs().show("label", data, 0);
1528 break;
1529 }
Ah... should I put statement 1524 after 1527?
No. That doesn't help.
- Martin