Hi,
did you get any help with your problem ? Here's what I could come up with..
On Sat, Jan 16, 2010 at 11:41 PM, Matt Gushee <[email protected]> wrote:
> Hello, folks--
>
> First post, sort of (I made an attempt to learn Factor early last year,
> and didn't get very far, but now I'm trying again--maybe this time I'll
> reach "escape velocity").
>
> As a learning exercise (and maybe an excuse to have a game on my laptop,
> which thus far has been free of such distractions ;-) I am trying to
> implement the classic Minesweeper game. So, for each cell in the grid, I
> need a gadget with the following characteristics:
>
> * At least 2 visual states, clicked and un-clicked, typically shown
> with a raised or flat appearance
> * Left-click and right-click event handlers
>
buttons handle all clicks the same way : (from button.factor)
button H{
{ T{ button-up } [ button-clicked ] }
{ T{ button-down } [ button-update ] }
{ mouse-leave [ button-leave ] }
{ mouse-enter [ button-enter ] }
} set-gestures
T{ button-down } handles any click (it's like T{ button-down f f f } ).
Left clicks are T{ button-down f f 1 } and right clicks T{ button-down f f 3
}.
I'm not sure on how to go from there; Maybe subclass button and copy/paste
it's gestures and add a line that handles the right click...?
> * The ability to display an icon or a character, and to change the icon
> at runtime
>
you can change a button's text with the following word
: replace-text ( button text -- )
[ drop children>> pop drop ]
[ >label add-gadget drop ] 2bi ;
I'm not sure if buttons are always supposed to have 1 child or not though..
It doesn't appear that there is any existing gadget that has all these
> characteristics, and I'm not sure what would be the best one to
> customize, but in other GUI toolkits I've worked with, button widgets
> work pretty well for this kind of thing, so I thought I would start by
> taking the border-button gadget and giving it a raised appearance. I
> created 3 TIFF images the same sizes as those used by the plain tile pen
> of the button pen of the border-button gadget. Then I created a new
> tile-pen using those images and new BG and FG colors, and assigned them
> to the plain slot of the button-pen.
>
> The result does indeed look different from the default, but it also
> looks different from what I expected, and quite ugly. I thought I would
> keep looking through the docs for an answer, but I'm just getting lost.
> I can post my code if people want to see it, but I think the real
> problem is not really a programming error, but rather that I don't
> understand how the various images and colors are used in constructing
> the button.
>
> So can someone explain how border-buttons are rendered (noting that,
> while I am reasonably familiar with 2D graphics terminology, I do *not*
> understand OpenGL [I've tried to learn it, failed, maybe try again
> someday, but not today, please])? Or perhaps provide a working example
> of gadget customization?
>
> Thanks for any & all info!
>
> --
> Matt Gushee
> [email protected]
>
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk