Re: Getting entry by key for a lexicon module.

"Troy A. Griffitts" <[email protected]>
Newsgroups gmane.comp.literature.sword.devel
Message-ID <[email protected]>
Hi David. You should skip the attempt to parse a verse list. Something 
simple like:

module->setKeyText("Moses");
SWBuf entryBody = module->renderText();
SWBuf entryKey = module->getKeyText();

Notice the renderText call before the getKeyText call. renderText will 
"snap" the requested key to the closest entry in the module. If you swap 
the order, the getKeyText will simply return whatever you set, which 
isn't too useful.

It's up to you to determine if the snapped entry is of use to your user 
if it is not exactly what you requested. In my frontends, I usually snap 
to the closest entry and then -- the module a couple times and then loop 
over 5 entries, which results in showing the snapped entry and 2 entries 
before and after, and I usually show this as the user types, so they can 
visually see the nearest entries so far, allowing them to navigate to 
their desired entry or see that nothing matches very well. Here is an 
example:

https://crosswire.org/study/examples/suggest.jsp?mod=Easton

Hope this is helpful.

Troy



On January 3, 2022 11:29:50 AM MST, "David "Judah's Shadow" Blue" 
<[email protected]> wrote:

    Ok. So I'm looking at getting a specific key for a lexdict module. I tried the
    same as I do for bibles/commentaries.

    sword::ListKey refRange;

    refRange = key.parseVerseList(reference.c_str(), key, true);
    for(refRange = sword::TOP; !refRange.popError(); refRange++) {
             module->setKey(refRange);
             text += " ";
             text += module->getKeyText();
             text += " ";
             text += module->stripText();
    }

    But I can only seem to get the last entry of the module.. I can't find any
    examples to go by for what I am doing wrong or how to do a lexicon with a
    single key.
    ------------------------------------------------------------------------
    sword-devel mailing list:[email protected]
    http://crosswire.org/mailman/listinfo/sword-devel
    Instructions to unsubscribe/change your settings at above page

_______________________________________________
sword-devel mailing list: [email protected]
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.