It is currently Mon Jan 25, 2021 2:30 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 525 posts ]  Go to page Previous  1 ... 31, 32, 33, 34, 35  Next
Author Message
 Post subject: Re: PureForm,PureColor = goofy text?
PostPosted: Mon Oct 17, 2011 11:21 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
jassing wrote:
Image
Notice the "blurry" text? It gets blurry as soon as the colour of the object beneath changes.
How can I avoid it?
#PureCOLOR_DontSetBackColor uses #HOLLOW_BRUSH to simulate a transparent background for static gadgets, so this is the expected result.
You may redraw the gadget, like this :
Code:
pWindow = OpenWindow(#PB_Any,0,0,10,10,"",#PB_Window_Invisible)
hWindow = OpenWindow(#PB_Any, 450, 200, 352, 62, "Having Fun", #PB_Window_SystemMenu,WindowID(pWindow))

hprog1 = ProgressBarGadget(#PB_Any, 6, 1, 340, 25, 0, 100, #PB_ProgressBar_Smooth)
hText1 = TextGadget(#PB_Any, 7, 3, 340, 20, "0%", #PB_Text_Center|#SS_CENTERIMAGE)

hProg2 = ProgressBarGadget(#PB_Any, 6, 31, 340, 25, 0, 100, #PB_ProgressBar_Smooth)
hText2 = TextGadget(#PB_Any, 5, 34, 340, 20, "0%", #PB_Text_Center|#SS_CENTERIMAGE)
SetWindowLongPtr_(GadgetID(hProg2), #GWL_STYLE, GetWindowLongPtr_(GadgetID(hProg2), #GWL_STYLE) | #WS_CLIPSIBLINGS)


SetGadgetFont(hText1, LoadFont(#PB_Any, "Microsoft Sans Serif", 8, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(hText2, LoadFont(#PB_Any, "Microsoft Sans Serif", 8, #PB_Font_Bold|#PB_Font_HighQuality))

PureCOLOR_SetGadgetColor(hText1, $FFFFFF, #PureCOLOR_DontSetBackColor)
PureCOLOR_SetGadgetColor(hText2, $FFFFFF, #PureCOLOR_DontSetBackColor)

For i = 0 To 100
  SetGadgetState(hProg2, i)
  RedrawWindow_(GadgetID(hProg2),0,0,#RDW_ERASE|#RDW_INVALIDATE) ;<------------ force redraw
  While WindowEvent() : Wend
  SetGadgetText(hText2, Str(i)+"%")
  While WindowEvent() : Wend
  Delay(100)
Next


Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
        Break
  EndSelect
ForEver

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Tue Oct 18, 2011 3:10 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 1324
Location: (Embarrassed to say country)
Thanks! but...

That actually made it worse, lots of "flashing" -- and the progbar gets changed from blue to black.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Tue Oct 18, 2011 4:25 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
You may use images.
An example :
Code:
Enumeration
  #Window_0
EndEnumeration
Enumeration
  #ProgressBar_0
  #ProgressBar_1
  #Text_0
EndEnumeration
;
Procedure ProcTextProgressBarGadget(hwnd, msg, wParam, lParam)
  Protected OldProc.l, ImgID.l, ImgID2.l, hdcOut.l, hdcIn.l, ps.PAINTSTRUCT, GadgetNumber.l
  Protected Text.s, BarColor.l, Progression.d, BackColor.l, ProgWidth.d, TextColor2.l
  OldProc = GetProp_(hwnd, "OldProc")
  TextColor = GetProp_(hwnd, "TextColor")
  TextColor2 = GetProp_(hwnd, "TextColor2")
  BackColor = GetProp_(hwnd, "BackColor")
  BarColor = GetProp_(hwnd, "BarColor")
  Select msg
    Case #WM_PAINT
      GadgetNumber = GetDlgCtrlID_(hwnd)
      Progression = (GetGadgetState(GadgetNumber) - GetGadgetAttribute(GadgetNumber, #PB_ProgressBar_Minimum)) / (GetGadgetAttribute(GadgetNumber, #PB_ProgressBar_Maximum) - GetGadgetAttribute(GadgetNumber, #PB_ProgressBar_Minimum))
      ProgWidth = GadgetWidth(GadgetNumber)* Progression
      Text = StrD(Progression * 100, 0) + "%"
      BeginPaint_(hwnd, @ps) ;>
        hdcOut = ps\hdc
        ImgID2 = CreateImage(#PB_Any, GadgetWidth(GadgetNumber), GadgetHeight(GadgetNumber), #PB_Image_DisplayFormat)
        StartDrawing(ImageOutput(ImgID2))
          DrawingMode(#PB_2DDrawing_Transparent)
          DrawingFont(GetStockObject_(#DEFAULT_GUI_FONT))
          Box(0, 0, GadgetWidth(GadgetNumber), GadgetHeight(GadgetNumber), BarColor)
          FrontColor(TextColor)
          DrawText(GadgetWidth(GadgetNumber) / 2 - 0.5 * TextWidth(Text), GadgetHeight(GadgetNumber) / 2 - 0.5 * TextHeight(Text), Text)
        StopDrawing()
        ImgID = CreateImage(#PB_Any, GadgetWidth(GadgetNumber), GadgetHeight(GadgetNumber), #PB_Image_DisplayFormat)
        hdcIn = StartDrawing(ImageOutput(ImgID))
          DrawingMode(#PB_2DDrawing_Transparent)
          DrawingFont(GetStockObject_(#DEFAULT_GUI_FONT))
          Box(0, 0, GadgetWidth(GadgetNumber), GadgetHeight(GadgetNumber), BackColor)
          FrontColor(TextColor2)
          DrawText(GadgetWidth(GadgetNumber) / 2 - 0.5 * TextWidth(Text), GadgetHeight(GadgetNumber) / 2 - 0.5 * TextHeight(Text), Text)
          If ProgWidth > 0
            ImgTmpID = GrabImage(ImgID2 , #PB_Any, 0, 0, ProgWidth, GadgetHeight(GadgetNumber))       
            If ImgTmpID
              DrawImage(ImageID(ImgTmpID), 0, 0)
              FreeImage(ImgTmpID)
            EndIf
          EndIf
          BitBlt_(hdcOut, 0, 0, GadgetWidth(GadgetNumber), GadgetHeight(GadgetNumber), hdcIn, 0, 0, #SRCCOPY)
        StopDrawing()
      EndPaint_(hwnd, ps) ;<
      FreeImage(ImgID)
      FreeImage(ImgID2)
      ProcedureReturn #Null
    Case #WM_NCDESTROY
      RemoveProp_(hwnd, "OldProc")
      RemoveProp_(hwnd, "TextColor")
      RemoveProp_(hwnd, "TextColor2")
      RemoveProp_(hwnd, "BackColor")
      RemoveProp_(hwnd, "BarColor")
  EndSelect
  ProcedureReturn CallWindowProc_(OldProc, hwnd, msg, wParam, lParam)
EndProcedure
Procedure CreateTextProgressBarGadget(GadgetNumber.l, X.l, Y.l, width.l, Height.l, Minimum.l, Maximum.l, FirstTextColor.l = #PB_Ignore, SecondTextColor.l = #PB_Ignore, BarColor.l = #PB_Ignore, BackColor.l = #PB_Ignore)
  Protected ImgID.l, ImgID2.l
  If FirstTextColor = #PB_Ignore
    FirstTextColor = GetSysColor_(#COLOR_WINDOWTEXT)
  EndIf
  If SecondTextColor = #PB_Ignore
    SecondTextColor = GetSysColor_(#COLOR_HIGHLIGHTTEXT)
  EndIf
  If BackColor = #PB_Ignore
    BackColor = GetSysColor_(#COLOR_BTNFACE)
  EndIf
  If BarColor = #PB_Ignore
    BarColor = GetSysColor_(#COLOR_HIGHLIGHT)
  EndIf
  ProgressBarGadget(GadgetNumber, X, Y, width, Height, Minimum, Maximum)
  SetProp_(GadgetID(GadgetNumber), "BackColor", BackColor)     
  SetProp_(GadgetID(GadgetNumber), "BarColor", BarColor)     
  SetProp_(GadgetID(GadgetNumber), "TextColor", SecondTextColor)     
  SetProp_(GadgetID(GadgetNumber), "TextColor2", FirstTextColor)     
  SetProp_(GadgetID(GadgetNumber), "OldProc", SetWindowLong_(GadgetID(GadgetNumber), #GWL_WNDPROC, @ProcTextProgressBarGadget()))     
EndProcedure
;
; ----------- T E S T ----------
;
If OpenWindow(#Window_0, 591, 251, 251, 110, "Text in progressbar", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
  If CreateGadgetList(WindowID(#Window_0))
    CreateTextProgressBarGadget(#ProgressBar_0, 5, 10, 240, 30, 0, 2000)
    CreateTextProgressBarGadget(#ProgressBar_1, 5, 50, 200, 30, 0, 1000, #Blue, #Red, #White, #Green)
    TextGadget(#Text_0, 5, 90, 245, 20, "", #PB_Text_Center)
  EndIf
EndIf
;
cc=0
Repeat
  Event = WaitWindowEvent(1)
  If cc<2000:cc+2
    SetGadgetState(#ProgressBar_0, cc)
    SetGadgetState(#ProgressBar_1, cc)
    SetGadgetText(#Text_0, Str(cc) + " / 2000")
  EndIf
  Select Event
    Case #PB_Event_CloseWindow
      CloseWindow(#Window_0)
      Break
  EndSelect
ForEver
There are a lot of colored progressbar codes available in the forum.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Tue Oct 18, 2011 7:10 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 1324
Location: (Embarrassed to say country)
Slick! Thanks for the ideas....


Top
 Profile  
Reply with quote  
 Post subject: Re: PureFORM 1.99 (yet another FORM designer)
PostPosted: Sun Apr 01, 2012 3:36 am 
Offline
PureBasic Protozoa
PureBasic Protozoa
User avatar

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4598
Location: Not Sydney!!! (Bad water, no goats)
When colouring PanelGadget, my tab icons do not get displayed.

Is there anything I can do about this?

**EDIT** Sorry, wrong forum, should have been for PureCOLOR

_________________
Amateur Radio, D-STAR/VK3HAF


Last edited by Fangbeast on Sun Apr 01, 2012 8:58 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: PureFORM 1.99 (yet another FORM designer)
PostPosted: Mon Apr 02, 2012 1:40 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Fangbeast wrote:
When colouring PanelGadget, my tab icons do not get displayed.
Is there anything I can do about this?
Unfortunately no.
PureCOLOR is quite old ; the library processes the #WM_DRAWITEM message to draw the text and at the time PB didn't support icons !
Something to add on the todo list I guess...

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureFORM 1.99 (yet another FORM designer)
PostPosted: Mon Apr 02, 2012 2:01 pm 
Offline
PureBasic Protozoa
PureBasic Protozoa
User avatar

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4598
Location: Not Sydney!!! (Bad water, no goats)
gnozal wrote:
Fangbeast wrote:
When colouring PanelGadget, my tab icons do not get displayed.
Is there anything I can do about this?
Unfortunately no.
PureCOLOR is quite old ; the library processes the #WM_DRAWITEM message to draw the text and at the time PB didn't support icons !
Something to add on the todo list I guess...


Sorry for complicating your life Gnozal. I think mine is quite complicated at the moment too.

Should be outside gardening and not coding.

_________________
Amateur Radio, D-STAR/VK3HAF


Top
 Profile  
Reply with quote  
 Post subject: Re: PureFORM 1.99 (yet another FORM designer)
PostPosted: Mon Apr 02, 2012 9:23 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Fangbeast wrote:
Sorry for complicating your life Gnozal. I think mine is quite complicated at the moment too.

No problem ;)
I will update the library tomorrow...

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Tue Apr 03, 2012 7:18 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Update (V16.11 for PB4.6x)

Changes :
- fixed : PureCOLOR should now support icons in panelgadget tabs

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Tue Apr 03, 2012 11:11 am 
Offline
PureBasic Protozoa
PureBasic Protozoa
User avatar

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4598
Location: Not Sydney!!! (Bad water, no goats)
Thanks for the hard work Gnozal, i'm happy to report that it works well.

/me bows

_________________
Amateur Radio, D-STAR/VK3HAF


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Fri May 25, 2012 3:43 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6282
Location: Wales, UK
Hi gnozal, a curious thing with ListIconGadgets (PB4.61).

If a ListIcon has alternate colour rows set with PureCOLOR_SetGadgetColorEx, PureCOLOR_GetCellColor and PureCOLOR_ClearCellColor do not work, though PureCOLOR_SetCellColor works fine.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Sat May 26, 2012 7:51 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
IdeasVacuum wrote:
If a ListIcon has alternate colour rows set with PureCOLOR_SetGadgetColorEx, PureCOLOR_GetCellColor and PureCOLOR_ClearCellColor do not work, though PureCOLOR_SetCellColor works fine.
It's the expected behavior (help file updated).
PureCOLOR_GetCellColor() and PureCOLOR_ClearCellColor() only work for colors set with PureCOLOR_SetCellColor().

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Sun May 27, 2012 2:33 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6282
Location: Wales, UK
Ah, thanks gnozal. Of course, we should know what colours were defined for alternate rows and so it is just a matter of testing if a row concerned is odd or even. If anyone else needs this:
Code:
Procedure.b IsOddInt(iNum.i)
;---------------------------

Protected bIsOdd.b = #True

     If Not (iNum % 2) : bIsOdd = #False : EndIf

     ProcedureReturn bIsOdd

EndProcedure

Then:
Code:
If(IsOddInt(iRow))

       PureCOLOR_SetCellColor(iList,iRow,iCol,iFrontColour,iRowColourOdd)
Else
       PureCOLOR_SetCellColor(iList,iRow,iCol,iFrontColour,iRowColourEven)
EndIf

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Wed Mar 27, 2013 8:55 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Library updated for PB5.1x

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureCOLOR library : coloring gadgets (and much more)
PostPosted: Fri Mar 29, 2013 1:18 pm 
Offline
User
User

Joined: Fri Sep 12, 2008 2:43 pm
Posts: 21
Location: Berlin
Hi Gnozal, I downloaded the zip-file from your site, but the version-number of the installer.exe is 500 and it's dated November last year. Is it really the version for PB 5.11?

OOPs, I just discovered, that there's a link to the PB-5.1-update right at the beginning of this thread.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 525 posts ]  Go to page Previous  1 ... 31, 32, 33, 34, 35  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye