Hi Philippe, I thought about this some, and came up with kind of a hybrid solution between the two. Since it would definitely be easiest to replace the characters with "*"s in the font code, we could add a "int password" member to the fontdesc structure. If it's zero, render the characters as normal, otherwise render that character instead. Note that it should be an int to facilitate using Unicode characters.
To render fonts using this password member, you'd have to add some code to outtext() and sizetext() in font.c to replace the decoded character with 'password' if it's nonzero. One advantage of using a font parameter is that widgets other than the field widget could take advantage of password entry. It might be useful in the textbox widget, for example. It is most intuitive from a client programming perspective to have a PG_WP_PASSWORD parameter you can set to "*" to enable password entry. There are two ways i can think of that the field widget would have to set the 'password' member of the fontdesc structure: - the field widget would keep its own copy of the fontdesc, which would be written to when the PG_WP_FONT property is set - or, the field widget would set the fontdesc's password member to the field's PG_WP_PASSWORD value at the beginning of build_field() then set it back to its original value at the end of build_field() Hope that helps :) -- Micah On 2002.01.08 09:28 Philippe Ney wrote: > Hi Micah, > > I had a look about how adding password display support for picogui. > I find 2 solutions (maybe there are more...) > > 1) using a PG_WP_PASSWORD widget properties and replacing the > displayed string with '*' in: > gcore/render.c -> void gropnode_draw() -> case PG_GROP_TEXT: ... > > 2) using a font modifier PG_FSTYLE_PASSWORD working in the same way as > PG_FSTYLE_ITALIC or PG_FSTYLE_UNDERLINE (I guess...) that will return > a '*' for every char. > > The first solution is the logical one (I think) but the second is > maybe easier to implement > What did you think about this? > > I do some work for the solution 1) but have some problem to get > divnode properties (widget type, flags) associated with processed grop > node. Do you have some tips about this? > > -philippe > > _______________________________________________ > Pgui-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/pgui-devel > _______________________________________________ Pgui-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/pgui-devel
