|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Wed Jan 23, 2013 1:39 am Post subject: Background color of window |
|
|
Here are two pictures and Fortran code. Upper picture is what the code below makes. How to modify this code to get different background color like on the photoshopped bottom picture?
Code: | use clrwin
i=winio@('%1.2ob&')
i=winio@('%ww&')
i=winio@('Method 1%ta%rb[Auto]%ff&',k1)
i=winio@('%ac[esc]&','exit')
i=winio@('%cb&')
i=winio@('Method 2%ta%rb[Auto]%ff&',k2)
i=winio@('%cn%bt[Exit]%ff&')
i=winio@('%cb')y
end |
Post modified code. With that I'd like to try to make this style GUIs with Clearwin :
Last edited by DanRRight on Wed Jan 23, 2013 11:08 am; edited 1 time in total |
|
Back to top |
|
|
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Wed Jan 23, 2013 6:56 am Post subject: |
|
|
Take a look at the %bg, %tc and %bc format codes. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Wed Jan 23, 2013 3:39 pm Post subject: |
|
|
Try, the example is very simple! |
|
Back to top |
|
|
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Wed Jan 23, 2013 4:10 pm Post subject: Re: |
|
|
DanRRight wrote: | Try, the example is very simple! |
Just tested... Got background coloured to blue using: %bg[blue] and text coloured to yellow using: %tc[yellow]. Button background colour changed to red using: %bc[red] and button text colour changed to white using: %bu[white].
Unfortunately, I could not get the box border colour changed from black to yellow... |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Wed Jan 23, 2013 7:02 pm Post subject: |
|
|
Yes this is what i got too. Hope Paul may comment how to change ob/cb color or even the color inside ob/cb and completely ideally how to put image inside ob/cb same or separate from the image which can make background of the window. The code and image of what maximum could be achieved is here
Code: | use clrwin
i=winio@('%tc&',rgb@(210,227,220))
i=winio@('%bg&',rgb@(11,18,79))
i=winio@('%1.2ob&')
i=winio@('%ww&')
i=winio@('Method 1%ta%rb[Auto]%ff&',k1)
i=winio@('%ac[esc]&','exit')
i=winio@('%cb&')
i=winio@('Method 2%ta%rb[Auto]%ff&',k2)
i=winio@('%cn%bc%bu[white]%bt[Exit]%ff&',rgb@(104,23,9))
i=winio@('%cb')
end |
You will agree that sometimes dark colors look better. Here is what i got just in 30 min versus a bit boring and much less informative older version shown for comparison. This is why i hope some day there will be styles and templates library where you just chose the template and its style and place your code and pictures into the sockets
Last edited by DanRRight on Sat Mar 30, 2013 12:41 am; edited 6 times in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Wed Jan 23, 2013 9:03 pm Post subject: |
|
|
The following provides a green background for the box. You can use %wp to provide a bitmap background for everything but controls drawn on top are not normally transparent.
Code: | use clrwin
i=winio@('%ww&')
i=winio@('%ac[esc]&','exit')
i=winio@('%tc&',rgb@(210,227,220))
i=winio@('%bg&',rgb@(11,18,79))
i=winio@('%`bg&',rgb@(0,100,0))
i=winio@('%1.2ob&')
i=winio@('Method 1%ta%rb[Auto]%ff&',k1)
i=winio@('%cb&')
i=winio@('Method 2%ta%rb[Auto]%ff&',k2)
i=winio@('%cn%bc%bu[white]%bt[Exit]%ff&',rgb@(104,23,9))
i=winio@('%cb')
end |
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Wed Jan 23, 2013 9:44 pm Post subject: |
|
|
Yes, it's also useful trick.
But is there possibility to make just the %ob/cb border of different color what we've tried to achieve?
Also less important but good to ask - if we put the texture with %wp it only changes background around ob/cb box while adding different texture with %wp inside the box does not change its background - see the same example with these %wp (one can make the whole area inside and outside %ob/cb box with the same texture adding i=winio@('%sy[3d_raised]&') though)
Code: | use clrwin
i=winio@('%ww&')
i=winio@('%ac[esc]&','exit')
i=winio@('%tc&',rgb@(210,227,220))
i=winio@('%bg&',rgb@(11,18,79))
i=winio@('%wp[bkgray05]&')
i=winio@('%1.2ob&')
i=winio@('%wp[bkgray06]&') ! <---- NO EFFECT INSIDE
i=winio@('Method 1%ta%rb[Auto]%ff&',k1)
i=winio@('%cb&')
i=winio@('Method 2%ta%rb[Auto]%ff&',k2)
i=winio@('%cn%bc%bu[white]%bt[Exit]%ff&',rgb@(104,23,9))
i=winio@('%cb')
end
resources
bkgray05 BITMAP bkgray05.bmp |
bkgray06 BITMAP bkgray06.bmp[/code]
|
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Wed Jan 23, 2013 11:30 pm Post subject: |
|
|
Dan,
If you change the Windows theme, then all the styling changes with it. Clearwin only offers a small set of changes relative to the current windows defaults.
You could use a bitmap background which included all the boxes drawn however you want them, then make the %ob - %cb arrangements in your Clearwin code [invisible].
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Wed Jan 23, 2013 11:33 pm Post subject: |
|
|
The box for %ob is drawn directly by ClearWin+ so I guess it would be possible to allow users to select the colour but it seems that you cannot do this at the moment.
Perhaps %ob[line_colour] should be added to ClearWin+ in order to ask for an rgb argument after the optional box title. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Thu Jan 24, 2013 6:11 am Post subject: |
|
|
Paul - that would be great.
Eddie - i mostly use texture backgrounds and very rarely anything is plotted on them. Graphical GUIs where everything is on %gr or %og window are the next level of complexity (require mostly artistic design, like here below). Do you have something eye-catching? Please post, will be glad to learn, even small thing counts (remember Motorola RAZR? The only new in this dumbphone was its fresh pinky color getting it out of gray crowd and it took States like a hurricane)!
Last edited by DanRRight on Thu Jan 24, 2013 7:57 pm; edited 2 times in total |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Thu Jan 24, 2013 7:48 pm Post subject: |
|
|
Quote: | The box for %ob is drawn directly by ClearWin+ |
By the way if this is in complete control can the analog of 'no-slide, no-down, no-right' %nd and %nr specifically for %ob be created too? Overall, the %ob is implemented surprisingly good but the look is completely ruined when you resize the window and all controls stay still but the %ob moves over them |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Thu Jan 24, 2013 9:39 pm Post subject: |
|
|
I guess so but it always helps if sample code is supplied. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Fri Jan 25, 2013 1:12 am Post subject: |
|
|
Here is animated gif
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Fri Jan 25, 2013 9:00 am Post subject: |
|
|
Thanks but the text of a short working program would be preferred. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Sun Jan 27, 2013 10:37 am Post subject: |
|
|
Here is one, when you resize the window you see this effect. Please take some bitmap as a texture for example this one (to emphasize one more time the under-text background issue). Ignore large callback functions, they are shown just for fun
The common sense tells that %ob/cb by its purpose should not slide if controls it is wrapping around do not slide. Or if everything slides when resizing then %ob/cb should follow controls like programmer intended and not run over controls independently. If we wrote %cb after some control
i=winio@('%bt[Exit]&')
i=winio@('%cb')
then this %cb defines the bottom line where %ob/cb can go when sliding. That's very annoying and obvious defect of otherwise very useful %ob/cb
Code: |
integer cbMouse, cbRun
external cbMouse, cbRun
real*8 Time_1, Time_2, Time_3
Time_1=1; Time_2=2; Time_3=3
ix=400; iy =300
ia=1;ib=0;ic=0;id=0
i=winio@('%ww[no_border,casts_shadow]&')
i=winio@('%sy[3d_raised]&')
I=WINIO@('%wp[moon0]&')
i=winio@('%mn[&File[E&xit]]&','EXIT')
i=winio@('%ac[esc]&','EXIT')
i=winio@('%nr%nd&')
i=winio@('%1.3ob&')
i=winio@('%rb[1]%rb[2]%rb[3]%rb[4]%ff&', ia,ib,ic,id)
i=winio@('%cb&')
i=winio@('Time_1, s %ta%`bg[white]%10rf%ff&', Time_1)
i=winio@('%cb&')
i=WINIO@('%cn%^tt[&Run]%ff&', cbRun)
i=winio@('Time_2, cm %ta%`bg[white]%10rf%ff&',Time_2)
i=winio@('%cb &')
i=winio@('%ob&')
i=winio@('%pv%`^gr[full_mouse_input,box_selection,user_resize,rgb_colours,black]&',ix, iy, ihw, cbMouse)
i=winio@('%cb')
END
integer function cbMouse()
use clrwin
character*20 text20
real*8 FontSize1
common iwin_width_, iwin_DEPTH_
text20 = 'ClearWin+'
FontSize1 = 14
LL = len_trim(text20)
call get_graphical_resolution@(iwin_width_, iwin_DEPTH_ )
call clear_screen@()
111 call SELECT_FONT@('Courier New')
call scale_font@(FontSize1)
call BOLD_FONT@( 1 )
call get_text_size@ (text20(1:ll), i_leng, ifontHight)
if(i_leng.gt.iwin_width_)then
FontSize1=FontSize1-0.1
if(FontSize1.le.0.1) goto 100
goto 111
endif
if(ifontHight.gt.iwin_DEPTH_)then
FontSize1=FontSize1-0.1
if(FontSize1.le.0.1) goto 100
goto 111
endif
100 iPosX = (iwin_width_ - i_leng)/2
if(iPosX.lt.0) iPosX = 0
iPosY = (iwin_DEPTH_ + ifontHight)/2
if(iPosY.lt.0) iPosY = 0
icolorSh = rgb@(255,255,255)
ix0 = iPosX+1
iy0 = iPosY+1
call draw_text@ (text20(1:LL), ix0, iy0, icolorSh)
icolorSh = rgb@(255,55,55)
ix0 = iPosX
iy0 = iPosY
call draw_text@ (text20(1:LL), ix0, iy0, icolorSh)
cbMouse=1
end
integer function cbRun()
use clrwin
common iwin_width_, iwin_DEPTH_
call draw_text@('Good job,',20,iwin_DEPTH_/3, rgb@(255,55,55))
cbRun=1
end
resources
moon0 BITMAP moon0.bmp
|
Last edited by DanRRight on Fri Mar 29, 2013 10:23 pm; edited 1 time in total |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|