return value from Nc_Note_Title_Text_Color_Get is wrong

9 views
Skip to first unread message

info.sim...@googlemail.com

unread,
Apr 6, 2023, 8:08:20 AM4/6/23
to Notecase Pro
When using Nc_Note_Title_Text_Color_Get the returned value is not a valid hex code.

e.g. i manually set the note title text color to #1E90FF. The returned value from Nc_Note_Title_Text_Color_Get is then 7710.
Similar test with hex #E6E6FA  returns 59110

Is this a bug or how can the returned value be converted into a valid hex value which can be used for e.g. Nc_Note_Title_Text_Color_Set

My use case is that I have a routine which updates inserted child notes with e.g. the icon from the parent note or the custom properties from the parent note. Wanted to extend the inheritance to the title text color

Any hint is highly welcome

Thanks
Raimund

Miroslav Rajcic

unread,
Apr 17, 2023, 7:10:09 AM4/17/23
to Notecase Pro
Hi Raimund,

sorry for a delay, this message somehow slipped through.
It seems that this API is not documented correctly, the function actually returns 3 integers, one each for red, green and blue color value.
This is a value between 0 and 65535, with 65535 indicating full intensity (this matches the way GdkColor structure from GTK encodes color).

int int int Nc_Note_Title_Text_Color_Get(int nDocumentID, string strNoteID)

so the usage would be something like:

nDocID = Nc_Doc_ID_GetCur()
strNoteID = Nc_Note_ID_GetCur(nDocID)
r, g, b = Nc_Note_Title_Text_Color_Get(nDocID, strNoteID)
Nc_GUI_MessageBox("Color: r=" .. r .. ", g=" .. g .. ", b=" .. b)

with result for your test color #1E90FF being:

"Color: r=7710, g=37008, b=65535"

@Paul, can you update the docs for this API ?

Best regards,
  Miro


From: 'info.sim...@googlemail.com' via Notecase Pro <noteca...@googlegroups.com>
Sent: Thursday, April 6, 2023 2:08 PM
To: Notecase Pro <noteca...@googlegroups.com>
Subject: return value from Nc_Note_Title_Text_Color_Get is wrong
 
--
You received this message because you are subscribed to the Google Groups "Notecase Pro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to notecase-pro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/notecase-pro/22e2c49a-6350-4ec2-af4e-034c57192979n%40googlegroups.com.

Virus-free.www.avast.com

Paul Merrell

unread,
Apr 17, 2023, 7:16:16 AM4/17/23
to noteca...@googlegroups.com
On Mon, Apr 17, 2023 at 4:10 AM Miroslav Rajcic <mra...@hotmail.com> wrote:
Hi Raimund,

sorry for a delay, this message somehow slipped through.
It seems that this API is not documented correctly, the function actually returns 3 integers, one each for red, green and blue color value.
This is a value between 0 and 65535, with 65535 indicating full intensity (this matches the way GdkColor structure from GTK encodes color).

int int int Nc_Note_Title_Text_Color_Get(int nDocumentID, string strNoteID)

so the usage would be something like:

nDocID = Nc_Doc_ID_GetCur()
strNoteID = Nc_Note_ID_GetCur(nDocID)
r, g, b = Nc_Note_Title_Text_Color_Get(nDocID, strNoteID)
Nc_GUI_MessageBox("Color: r=" .. r .. ", g=" .. g .. ", b=" .. b)

with result for your test color #1E90FF being:

"Color: r=7710, g=37008, b=65535"

@Paul, can you update the docs for this API ?

Done.
 
--
You received this message because you are subscribed to the Google Groups "Notecase Pro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to notecase-pro...@googlegroups.com.


--
[Notice not included in the above original message:  The U.S. National Security Agency neither confirms nor denies that it intercepted this message.]
                                                ¯\_(ツ)_/¯

Miroslav Rajcic

unread,
Apr 17, 2023, 7:44:05 AM4/17/23
to noteca...@googlegroups.com
That was fast Paul, thanks!

From: noteca...@googlegroups.com <noteca...@googlegroups.com> on behalf of Paul Merrell <mar...@gmail.com>
Sent: Monday, April 17, 2023 1:16 PM
To: noteca...@googlegroups.com <noteca...@googlegroups.com>
Subject: Re: return value from Nc_Note_Title_Text_Color_Get is wrong
 
Reply all
Reply to author
Forward
0 new messages