XP skinned calendar with no skinned editor?

Just starting out? Need help? Post your questions and find answers here.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

XP skinned calendar with no skinned editor?

Post by rsts »

If you compile the code below with XP styles enabled you should be able to notice a distinct line around the editorGadget. However, without xp skins enabled the editorGadget almost "blends" into the surrounding panelGadget. This is the effect I want. But I also want the calendar style of xp skins enabled, since imho the other style leaves a bit to be desired.

Is there a way I can have the look of the editorGadget as it looks without xp skins while retaining the xp skinned calendar appearance?

cheers

Code: Select all

;{ Windows
Enumeration
  #Window_0
EndEnumeration
;}
Global gadget_0_editor
;{ Gadgets
Enumeration
  #Calendar_0
  #Panel_1

EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;}
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 450, 200, 400, 453, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
 
      CalendarGadget(#Calendar_0, 35, 15, 230, 185)
      PanelGadget(#Panel_1, 35, 220, 330, 225)
        ; Tab #1
        AddGadgetItem(#Panel_1, -1, "Tab #1")
       gadget_0_editor= EditorGadget(#PB_Any, 10, 10, 295, 175)
       style = GetWindowLong_(GadgetID(Gadget_0_Editor), #GWL_EXSTYLE) 
      newstyle = style &(~#WS_EX_CLIENTEDGE) 
      SetWindowLong_(GadgetID(Gadget_0_Editor), #GWL_EXSTYLE, newstyle) 
     SetWindowPos_(GadgetID(Gadget_0_Editor), 0, 0, 0, 0, 0, #SWP_SHOWWINDOW | #SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED) ; required for this to work on my Win98 
  EndIf
EndProcedure

OpenWindow_Window_0()

;{- Event loop
Repeat
  Event = WaitWindowEvent()
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #Calendar_0
      ElseIf EventGadget = #Panel_1
     
      EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver
;
;}
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Re: XP skinned calendar with no skinned editor?

Post by Arctic Fox »

Perhaps something like this (if necessary then in a ContainerGadget)?

Code: Select all

CalendarGadget(#Calendar_0, 35, 15, 167, 158, -1, #PB_Calendar_Borderless)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: XP skinned calendar with no skinned editor?

Post by srod »

If you just wish to remove themes from an individual control then try SetWindowTheme_(GadgetID(#MyGadget),@null.w,@null)
I may look like a mule, but I'm not a complete ass.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Re: XP skinned calendar with no skinned editor?

Post by Fluid Byte »

Nice try srod but that won't work. The themed border isn't actually supported by Windows for RichEdit controls so I'm pretty sure Fred uses an home-brew fix. What you can do is process the #WM_NCPAINT message and permit to draw the themed border.

Code: Select all

OpenWindow(0,450,200,400,453,"void",#PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_TitleBar)

CalendarGadget(0,35,15,230,185)
PanelGadget(1,35,220,330,225)
AddGadgetItem(1,-1,"Tab #1")
EditorGadget(2,10,10,295,175)

Global lpPrevFunc

Procedure RichEditProc(hWnd,uMsg,wParam,lParam)
	Select uMsg
		Case #WM_NCPAINT
		GetClientRect_(hwnd,crc.RECT)
		hdc = GetWindowDC_(hWnd)
		hPenBorder = CreatePen_(#PS_INSIDEFRAME,2,GetSysColor_(#COLOR_WINDOW))
		SelectObject_(hdc,hPenBorder)
		SelectObject_(hdc,GetStockObject_(#NULL_BRUSH))
		Rectangle_(hdc,0,0,crc\right + 4,crc\bottom + 4)
		DeleteObject_(hPenBorder)
		ReleaseDC_(hwnd,hdc)
		ProcedureReturn 0
	EndSelect
	
	ProcedureReturn CallWindowProc_(lpPrevFunc,hWnd,uMsg,wParam,lParam)
EndProcedure

lpPrevFunc = SetWindowLong_(GadgetID(2),#GWL_WNDPROC,@RichEditProc())

SetWindowPos_(GadgetID(2), 0, 0, 0, 0, 0,#SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED)

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: XP skinned calendar with no skinned editor?

Post by srod »

Ah, yes of course - daft twit I am. Should have known better. :)

Must admit that I didn't try it as I'm up to my neck in malfunctioning code right now ... my own code that is! :wink:
I may look like a mule, but I'm not a complete ass.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: XP skinned calendar with no skinned editor?

Post by RASHAD »

I had enough trouble for one day
I should't respond
is that what you are after rsts?
Do not answer

Code: Select all

;{ Windows
Enumeration
  #Window_0
EndEnumeration
;}
Global gadget_0_editor
;{ Gadgets
Enumeration
  #Calendar_0
  #Panel_1

EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu



    OpenWindow(#Window_0, 450, 200, 400, 453, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)

      CalendarGadget(#Calendar_0, 35, 15, 225, 160)
      pHwnd=PanelGadget(#Panel_1, 35, 220, 330, 225)
        ; Tab #1
        AddGadgetItem(#Panel_1, -1, "Tab #1")
       gadget_0_editor= EditorGadget(#PB_Any, 10, 10, 295, 175)
       SetWindowTheme_(pHwnd, @null.w, @null.w)
        style = GetWindowLong_(GadgetID(Gadget_0_Editor), #GWL_EXSTYLE)
       newstyle = style &(~#WS_EX_CLIENTEDGE)
       SetWindowLong_(GadgetID(Gadget_0_Editor), #GWL_EXSTYLE, newstyle)
      SetWindowPos_(GadgetID(Gadget_0_Editor), 0, 0, 0, 0, 0, #SWP_SHOWWINDOW | #SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED) ; required for this to work on my Win98



;{- Event loop
Repeat
  Event = WaitWindowEvent()
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #Calendar_0
      ElseIf EventGadget = #Panel_1
     
      EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver
;
;}
Last edited by RASHAD on Wed Oct 21, 2009 7:22 pm, edited 1 time in total.
Egypt my love
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Re: XP skinned calendar with no skinned editor?

Post by Arctic Fox »

Seems that I misunderstood this :?
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: XP skinned calendar with no skinned editor?

Post by rsts »

Yes, Mr Byte, that looks quite nice. Many thanks.

Now to see how it will look after i work my magic of inserting it in my program :)

cheers
Post Reply