On Sun, Jan 17, 2010 at 11:41 AM, 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").
Sorry for the late reply, I've been stuck doing VM hacking :-) > 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 > > * The ability to display an icon or a character, and to change the icon > at runtime > > 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, In this case I'd suggest making your own gadget from scratch. Have it respond to button-down or button-up gestures, and use the hand-loc variable to get the mouse location. Render the board in a method on the draw-gadget* generic word. The extra/tetris demo provides a good example of how to do basic UI tasks such as these. Bear in mind that it was one of the first demos we had, and some of the code in there could be written better with newer Factor idioms. > 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. Factor's button, slider and labelled gadgets -- all the ones that use .tiff images to render borders, etc -- are not really skinnable like that. They're not designed to be used with any images other than the default theme. However, note that you can reuse button gadgets, with your own button-pen. Slava ------------------------------------------------------------------------------ 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
