1. Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 10, 2004
- 532 views
Is there any way to have a label or text in the status bar that is colored and bold? Or ideally, can different areas of the status bar be different colors? -- MrTrick ------------------------------------------------------------------------------------- magnae clunes mihi placent, nec possum de hac re mentiri.
2. Re: Colored statusbar or label
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 10, 2004
- 503 views
-- Derek Parnell Melbourne, Australia
3. Re: Colored statusbar or label
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 10, 2004
- 516 views
Patrick Barnes wrote: > > Is there any way to have a label or text in the status bar that is > colored and bold? > > Or ideally, can different areas of the status bar be different colors? I'm pretty sure that the Microsoft statusbar does not support 'fancy' stuff like that. You will have to do your own, or ask somebody to do it, or wait till I get around to doing one -- Derek Parnell Melbourne, Australia
4. Re: Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 10, 2004
- 514 views
On Tue, 09 Nov 2004 23:57:58 -0800, Derek Parnell <guest at rapideuphoria.com> wrote: > posted by: Derek Parnell <ddparnell at bigpond.com> > > Patrick Barnes wrote: > > > > Is there any way to have a label or text in the status bar that is > > colored and bold? > > > > Or ideally, can different areas of the status bar be different colors? > > I'm pretty sure that the Microsoft statusbar does not support 'fancy' > stuff like that. You will have to do your own, or ask somebody to do it, > or wait till I get around to doing one Alright... So lets say I wanted to draw graphics in a status bar.... How could I do that? -- MrTrick
5. Re: Colored statusbar or label
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 10, 2004
- 545 views
Patrick Barnes wrote: > > On Tue, 09 Nov 2004 23:57:58 -0800, Derek Parnell > <guest at rapideuphoria.com> wrote: > > posted by: Derek Parnell <ddparnell at bigpond.com> > > > > Patrick Barnes wrote: > > > > > > Is there any way to have a label or text in the status bar that is > > > colored and bold? > > > > > > Or ideally, can different areas of the status bar be different colors? > > > > I'm pretty sure that the Microsoft statusbar does not support 'fancy' > > stuff like that. You will have to do your own, or ask somebody to do it, > > or wait till I get around to doing one > > Alright... > > So lets say I wanted to draw graphics in a status bar.... How could I do that? Is this sort of thing helpful? ------------------
without warning include win32lib.ew constant Win = create(Window, "TEST", 0, 0, 0, 400, 400, 0) constant SB = create(StatusBar, "", Win, 0, 0, 0, 50, 0) procedure Paint_SB(integer self, integer event, sequence parms) setPenColor(self, Red) drawRectangle(self, 1, 3, 3, 150, 50) setPenColor(self, Green) drawRectangle(self, 1, 150, 3, 300, 50) setPenColor(self, Blue) setFont(self, "Courier New", 12, Bold) wPuts({self, 4,4}, "hello") setFont(self, "Arial", 12, Italic) wPuts({self, 154,4}, "world") end procedure setHandler(SB, w32HPaint, routine_id("Paint_SB")) VOID = setErasePolicy(SB, 1) WinMain(Win , Normal)
------------------ -- Derek Parnell Melbourne, Australia
6. Re: Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 10, 2004
- 515 views
On Wed, 10 Nov 2004 03:25:18 -0800, Derek Parnell <guest at rapideuphoria.com> wrote: > Is this sort of thing helpful? Uh, I see a big statusbar, and 'world' in italics... But no colors, and 'world' is black. > ------------------ > }}} <eucode> > without warning > include win32lib.ew > > constant Win = create(Window, "TEST", 0, 0, 0, 400, 400, 0) > > constant SB = create(StatusBar, "", Win, 0, 0, 0, 50, 0) > > procedure Paint_SB(integer self, integer event, sequence parms) > > setPenColor(self, Red) > drawRectangle(self, 1, 3, 3, 150, 50) > setPenColor(self, Green) > drawRectangle(self, 1, 150, 3, 300, 50) > setPenColor(self, Blue) > setFont(self, "Courier New", 12, Bold) > wPuts({self, 4,4}, "hello") > setFont(self, "Arial", 12, Italic) > wPuts({self, 154,4}, "world") > end procedure > setHandler(SB, w32HPaint, routine_id("Paint_SB")) > VOID = setErasePolicy(SB, 1) > WinMain(Win , Normal) > </eucode> {{{ -- MrTrick
7. Re: Colored statusbar or label
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 10, 2004
- 553 views
Patrick Barnes wrote: > > On Wed, 10 Nov 2004 03:25:18 -0800, Derek Parnell > <guest at rapideuphoria.com> wrote: > > Is this sort of thing helpful? > > Uh, I see a big statusbar, and 'world' in italics... > > But no colors, and 'world' is black. Oops. That should be "setTextColor(self, Blue)" I see colors. I've tested with v0.60.0 and upwards and it works. What version of win32lib are you using. And Windows too for that matter? -- Derek Parnell Melbourne, Australia
8. Re: Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 10, 2004
- 485 views
On Wed, 10 Nov 2004 04:20:06 -0800, Derek Parnell <guest at rapideuphoria.com> wrote: > > Uh, I see a big statusbar, and 'world' in italics... > > But no colors, and 'world' is black. > Oops. That should be "setTextColor(self, Blue)" > > I see colors. I've tested with v0.60.0 and upwards and it works. I see a blue 'world' now, but not any of the other colors. > What version of win32lib are you using. And Windows too for that matter? I'm using v0.60.6 (19 September), on windows 2000 Haven't done anything odd with this machine, not sure what's up. I'll try that code snippet on my XP machine at work tomorrow. -- MrTrick
9. Re: Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 11, 2004
- 522 views
It's no big problem, I only need to display colors, not text, so I can just remove the statusbar and draw the colors in the window normally. What about hint text? I'd like it if I could hover the mouse over the colored rectangle, and have a hint text appear if the mouse was there long enough. On Thu, 11 Nov 2004 00:03:20 +1100, Patrick Barnes <mrtrick at gmail.com> wrote: > > > On Wed, 10 Nov 2004 04:20:06 -0800, Derek Parnell > <guest at rapideuphoria.com> wrote: > > > Uh, I see a big statusbar, and 'world' in italics... > > > But no colors, and 'world' is black. > > Oops. That should be "setTextColor(self, Blue)" > > > > I see colors. I've tested with v0.60.0 and upwards and it works. > I see a blue 'world' now, but not any of the other colors. > > > What version of win32lib are you using. And Windows too for that matter? > I'm using v0.60.6 (19 September), on windows 2000 > > Haven't done anything odd with this machine, not sure what's up. I'll > try that code snippet on my XP machine at work tomorrow. > > -- > MrTrick > > -- MrTrick
10. Re: Colored statusbar or label
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 11, 2004
- 513 views
Patrick Barnes wrote: > > It's no big problem, I only need to display colors, not text, so I can > just remove the statusbar and draw the colors in the window normally. > > What about hint text? I'd like it if I could hover the mouse over the > colored rectangle, and have a hint text appear if the mouse was there > long enough. Sure, just user LText to simulate this... -----------------
without warning include win32lib.ew constant Win = create(Window, "TEST", 0, 0, 0, 400, 400, 0) function CreateSB( sequence pSBDef) sequence lSB lSB = {} for i = 1 to length(pSBDef) do lSB = append(lSB, {0, -- id pSBDef[i] -- width }) lSB[length(lSB)][1] = createEx(LText, "", Win, 0, 0, 0, 0,SS_LEFTNOWORDWRAP, WS_EX_CLIENTEDGE) end for return lSB end function sequence SB SB = CreateSB({0.25, 0.15, .33, -1}) procedure Repaint_Win(integer self, integer event, sequence parms) sequence lRect integer lLeft integer lWidth lRect = getClientSize(self) lLeft = 0 for i = 1 to length(SB) - 1 do if SB[i][2] < 1 then lWidth = floor(lRect[3] * SB[i][2]) else lWidth = SB[i][2] end if setRect(SB[i][1], lLeft, lRect[4]-34, lWidth, lRect[4], 1) lLeft += lWidth end for setRect(SB[length(SB)][1], lLeft, lRect[4]-34, lRect[3], lRect[4], 1) end procedure setHandler(Win, w32HResize, routine_id("Repaint_Win")) setTextColor(SB[1][1], Blue) setWindowBackColor(SB[1][1], Red) setFont(SB[1][1], "Courier New", 12, Bold) setHint(SB[1][1], "This be SB1") setText(SB[1][1], " Euphoria") setTextColor(SB[2][1], BrightWhite) setWindowBackColor(SB[2][1], Green) setFont(SB[2][1], "Arial", 12, Italic) setHint(SB[2][1], "And this be SB2") setText(SB[2][1], " says") setTextColor(SB[3][1], Cyan) setWindowBackColor(SB[3][1], BrightCyan) setFont(SB[3][1], "Tahoma", 12, Bold) setHint(SB[3][1], "This be SB3") setText(SB[3][1], " HELLO") setTextColor(SB[4][1], Purple) setWindowBackColor(SB[4][1], Parchment) setFont(SB[4][1], "Times New Roman", 12, Italic) setHint(SB[4][1], "And this be SB4") setText(SB[4][1], " world!") WinMain(Win , Normal)
----------------- -- Derek Parnell Melbourne, Australia
11. Re: Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 11, 2004
- 531 views
On Thu, 11 Nov 2004 00:04:11 -0800, Derek Parnell <guest at rapideuphoria.com> wrote: > posted by: Derek Parnell <ddparnell at bigpond.com> > Sure, just use LText to simulate this... <SNIP> Interesting! I think I'll do that. -- MrTrick
12. Re: Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 12, 2004
- 555 views
On Thu, 11 Nov 2004 22:19:25 +1100, Patrick Barnes <mrtrick at gmail.com> wrote: > On Thu, 11 Nov 2004 00:04:11 -0800, Derek Parnell > <guest at rapideuphoria.com> wrote: > > posted by: Derek Parnell <ddparnell at bigpond.com> > > Sure, just use LText to simulate this... > <SNIP> > Interesting! > I think I'll do that. Argh... whatever I did broke it. Can you figure out why this code doesn't show any hint text? without warning include win32lib.ew constant Win = create(Window, "TEST", 0, 0, 0, 100, 100, 0) setClientRect(Win, 400,400 ) constant colors = { BrightGreen, BrightBlue, BrightRed, Yellow} constant hints = { "Green Bar", "Blue Bar", "Red Bar", "Yellow Bar" } --Create a new health bar with 'players' players. function newHealthBar(integer win, integer num_of_players, sequence hints) sequence tmp_hb tmp_hb = {} for i = 1 to num_of_players do tmp_hb &= createEx(LText, "", win, 0, 0, 0, 0,0, WS_EX_CLIENTEDGE) setWindowBackColor(tmp_hb[i], colors[i] ) setHint(tmp_hb[i], hints[i] ) end for return tmp_hb end function constant scores = {rand(100), rand(100), rand(100), rand(100)} constant total = scores[1] + scores[2] + scores[3] + scores[4] constant players = 4 constant hb = newHealthBar(Win, players, hints) procedure scaleHealthBar(integer total, sequence scores, integer win) sequence w_rect integer left_side, width w_rect = getClientSize(win) left_side = 0 width = 0 --Re-position each bar to fit the score/window for i = 1 to length(scores) do width = floor(w_rect[3]*scores[i]/total) setRect(hb[i], left_side, w_rect[4]-20, width, 23, 1) left_side += width end for end procedure procedure Resize_Win(integer self, integer event, sequence parms) scaleHealthBar( total, scores, Win) end procedure setHandler(Win, w32HResize, routine_id("Resize_Win")) WinMain(Win , Normal) -- MrTrick
13. Re: Colored statusbar or label
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 12, 2004
- 528 views
Patrick Barnes wrote: > Argh... whatever I did broke it. Can you figure out why this code > doesn't show any hint text? No I can't ... because it shows the hint text when I test your code. I'm using Windows XP and win32lib 0.60.6 -- Derek Parnell Melbourne, Australia
14. Re: Colored statusbar or label
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 12, 2004
- 546 views
On Thu, 11 Nov 2004 21:43:09 -0800, Derek Parnell <guest at rapideuphoria.com> wrote: > > No I can't ... because it shows the hint text when I test your code. > > I'm using Windows XP and win32lib 0.60.6 So am I! Arrgh... perhaps a reboot is in order. -- MrTrick