Re: widgets

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi, tacitus,

You wrote:

>the msgbox.e name conflicts with same-named routine in euphoria
>include folder

Sorry, that's really stupid. I have just changed it to mbox.e.

>in higher resolutions, my rat leaves an ugly trail behind it.
>use_vesa() doesn't fix.

use_vesa() would not fix it, because it is used internally in
widgets.e anyway. This is the first time I have heard about it, it has
always worked for me on all machines in all resolutions, but there are
so many weird graphics cards out there these days...

>i'd like a library function that returns:
>-the user's default resolution in windows; and/or
>-the highest resolution of which the card and monitor are capable;

The first bit is no doubt possible, but of very little value to the
dos programmer, and the second one I guess truly impossible because I
can't really even imagine how to interrogate the monitor.

>the widgets look really cool in high resolution, except for the
>poorly house-trained rat, and the fact that the default font is quite
>small.

And I thought it was too big ;), but I rarely use higher resolutions
than 800x600. The default font is Colin Taylor's sysb13.f, but you can
choose any other font you like. There are literally hundreds of them
floating around. All you have to do is to load it somewhere at the top
of your program and assign its handle to the global variable
default_font. In fact almost every bit of text is a widget (an object
in OOP terms) that carries a complete set of properties with it. And
they all can be changed at any stage. There are numerous examples of
how to do it included in the package.

>in the various controls displaying text, such as sle or reader, text
>including a tilde "~" adopts the hotkey behaviour of a tilde - i.e.
>the tilde disappears and the letter(s) following the first tilde
>change to the hotkey colour until you get to the next tilde. this is a
>problem because dos filenames so often include tildes. in an sle
>control, the behaviour is doubly baffling to the user, because it
>only happens after you press enter. the sle then returns the full
>text to the program but only displays the tildeless text.

Interpretation of the tilde depends on the 'hilite' text attribute.
The default for widgets is 'hilite on'. It means that every tilde
encountered in the text acts as a toggle between normal and hilite
foreground color (hotkey color). But the hilite attribute can be
easily switched off; the tilde is then shown as usual. The file
selector is probably the best example to follow.

>i really think the documentation is hard for learners.

It's even worse than that, it is non-existent. I included a lot of
examples - a lazy way of dealing with the problem, if you wish, but I
really do not know how to construct good, or even adequate docs for
such complex topic. I know of only about ten people really interested
in using the widgets, and they range, as far as I can judge, from
complete novices to very experienced programmers. So where do I start
if I really do not want to spend the rest of my days writing
documentation, an activity that I hate just as much as any other
programmer?

>to fetch the selected choice of two radio buttons, i eventually came
>up with this, which looks far too long to be correct:
>
>object recursion, non_recursion, selection
>recursion = part(recurse_buttons, 257 & "Recursive")
>non_recursion = part(recurse_buttons, 257  "Non-recursive")
>selection = item(recurse_buttons, "sel")
>if selection = non_recursion then
>return 0
>elsif selection = recursion then
>return 1
>else return -- error message handler
>end if

Your approach is essentially correct, but you can achieve exactly the
same thing with a one-liner:

return part(recurse_buttons, 257 & "Recursive") = item(recurse_buttons, "sel")

With just two coupled radio buttons, one of them must always be
selected. Your 'else' clause is redundant. Btw, would not a simple
checkbox (say "Recurse") be a better choice?

>is there an easier way, or should i be writing a library like
>win32lib? if latter, wouldn't external library written like this be
>slow? (did you notice that hint, jiri?)

Sorry, tacitus, I am a bit on the slow side, I have no clue what you
are talking about. Your hint is way too subtle...

>an area i struggled with was knowing what items and components were,
>both in terms of what they represent and what they return.

It's really incredibly simple. Let's see whether I can summarize it in
less than a dozen lines:

An instance of a widget is a sequence, a list of labeled items. When
the widget is created, this list is appended to the main global
sequence wid, and from then on the widget is identifiable by its index
into the main sequence. Individual items of the list describe various
aspects of the widget, its properties, if you like. So for example
"box" is a label for a sequence {x,y,width,height}, "sho" (short for
'show') contains routine_id of the procedure to display the widget,
etc. Often there is just one special item in this list of properties
which is labeled "par" (short for 'parts'). It is nothing more than a
labeled sublist of component widgets, their own wid indices.

Well, that's ten lines exactly and I did not even try terribly hard:).

>for example, when working with radio buttons, i print()ed the indexes
>of each button and got 75,77,79 and 81 - completely random numbers to
>me, which is one of the reasons i ended up with the above code. there
>are some items that are not documented at all, such as "sta" (?????).

I hope the 'completely random numbers' make more sense now. Those
awful abbreviations are another story: at one stage I became quite
obsessed with speed. Since lists with longer labels take longer to
search, I went through the lot and vandalized almost all labels to
only three letters. Stupid. The speed advantage is so minuscule, it's
almost undetectable, and the whole thing has become unrecognizable
nightmare, unless of course your English is as bad as mine.

>i'd be happy to help with documentation if i was confident i knew
>what i was writing about. (i actually know something about writing).

You are on. When can you start?

>in the demos, there was a line p(w) or something like that. i
>couldn't find any documentation on it at all. can anyone tell me what
>it does?

pw(widget_index). It is a crude debugging tool declared at the very
end of widgets.e. It uses Pete's smart_print to show widget's
properties in a sort of 'pretty print' format.

Thanks, tacitus!

jiri

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu