EditorGadget border and scrollbars

Just starting out? Need help? Post your questions and find answers here.
karu
Enthusiast
Enthusiast
Posts: 255
Joined: Fri Jan 13, 2006 12:14 am

EditorGadget border and scrollbars

Post by karu »

Hi
Mayby it already written somewhere but i did not find it, so i asc again, howto:
disable in editorgadget scrollbars
disable editorgadget borders
select all text in editoegadget

Thanks

Karu
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: EditorGadget border and scrollbars

Post by RASHAD »

Hi

Code: Select all

Procedure Editor_Select(Gadget, LineStart.i, CharStart.i, LineEnd.i, CharEnd.i)
  sel.CHARRANGE
  sel\cpMin = SendMessage_(GadgetID(Gadget), #EM_LINEINDEX, LineStart, 0) + CharStart - 1

  If LineEnd = -1
    LineEnd = SendMessage_(GadgetID(Gadget), #EM_GETLINECOUNT, 0, 0)-1
  EndIf
  sel\cpMax = SendMessage_(GadgetID(Gadget), #EM_LINEINDEX, LineEnd, 0)

  If CharEnd = -1
    sel\cpMax + SendMessage_(GadgetID(Gadget), #EM_LINELENGTH, sel\cpMax, 0)
  Else
    sel\cpMax + CharEnd - 1
  EndIf
  SendMessage_(GadgetID(Gadget), #EM_EXSETSEL, 0, @sel)
EndProcedure

OpenWindow(0,0,0,300,230,"EditorGadget",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  EditorGadget(1,5,5,290,190)
  RemoveGadgetItem(1,0)               ;Fix cursor dir with Bidirection system in XP theme enabled

  ;{ No border
  SetWindowLong_(GadgetID(1), #GWL_EXSTYLE,GetWindowLong_(GadgetID(1), #GWL_EXSTYLE)&(~#WS_EX_CLIENTEDGE))
  SetWindowPos_(GadgetID(1), 0, 0, 0, 0, 0, #SWP_SHOWWINDOW | #SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED)
  ;}
  For a=0 To 5 
    AddGadgetItem(1,a,"Line "+Str(a)) 
  Next 
  ButtonGadget(2,5,200,100,20,"Select") 
Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow: End 
    Case #PB_Event_Gadget 
      Select EventGadget()
        Case 1
        SendMessage_(GadgetID(1), #EM_SHOWSCROLLBAR,#SB_HORZ,0)
        SendMessage_(GadgetID(1), #EM_SHOWSCROLLBAR,#SB_VERT,0)
       
        Case 2
        Editor_Select(1,0,1,0,1)     ;Set cursor at start position
        Editor_Select(1,0,1,-1,-1)   ;Select the req. text
        
      EndSelect 
  EndSelect 
ForEver

Egypt my love
Christian
Enthusiast
Enthusiast
Posts: 154
Joined: Mon Dec 08, 2003 7:50 pm
Location: Germany

Re: EditorGadget border and scrollbars

Post by Christian »

Hi,

somehow GetWindowLong_() doesn't return the right values for the EditorGadget since PB 4.4 ... any idea what was changed and how I can remove the border of the EditorGadget in any other way?

EDIT: Problem only occurs with "XP skin support" on. But it worked perfectly in PB 4.31 ... :?

regards,
Christian
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Re: EditorGadget border and scrollbars

Post by Fluid Byte »

The EditorGadget doesn't use WS_EX_CLIENTEDGE. It's a special PB fix.

Take a look here: http://www.purebasic.fr/english/viewtop ... 99&start=3

//Edit:

Or use a container gadget:

Code: Select all

OpenWindow(0,0,0,320,220,"void",#WS_OVERLAPPEDWINDOW | 1)
ContainerGadget(0,10,10,300,200)
EditorGadget(1,-2,-2,304,204)
CloseGadgetList()

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Christian
Enthusiast
Enthusiast
Posts: 154
Joined: Mon Dec 08, 2003 7:50 pm
Location: Germany

Re: EditorGadget border and scrollbars

Post by Christian »

The EditorGadget doesn't use WS_EX_CLIENTEDGE. It's a special PB fix.
The WS_EX_CLIENTEDGE-Method works with "XP skin support" turned off in the compiler options. Apart from that everything worked fine in PB 4.30 with both, XP skin support turned on or off. So anything was changed in PB 4.40. Any idea what?

However, you're link seems to do the job now. Thanks!
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Re: EditorGadget border and scrollbars

Post by Fluid Byte »

Christian wrote:The WS_EX_CLIENTEDGE-Method works with "XP skin support" turned off in the compiler options.
Fluid Byte wrote:The EditorGadget doesn't use WS_EX_CLIENTEDGE. It's a special PB fix.
With theme support turned off WS_EX_CLIENTEDGE is used but otherwise PB uses the Windows skinning library to draw the border.
Why? Because a plain RichEdit control created via API doesn't use a themed border by default.
Christian wrote:So anything was changed in PB 4.40. Any idea what?
Yes, the drawing library was completely redone in 4.50.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Christian
Enthusiast
Enthusiast
Posts: 154
Joined: Mon Dec 08, 2003 7:50 pm
Location: Germany

Re: EditorGadget border and scrollbars

Post by Christian »

Fluid Byte wrote:With theme support turned off WS_EX_CLIENTEDGE is used but otherwise PB uses the Windows skinning library to draw the border.
Why? Because a plain RichEdit control created via API doesn't use a themed border by default.
So, PureBasic didn't use the Windows skinning library to draw the border in version 4.30? How was it done before?
Fluid Byte wrote:Yes, the drawing library was completely redone in 4.50.
Yes, I know that. But I didn't know that those changes also affect the way the PB Gadgets are drawn.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Re: EditorGadget border and scrollbars

Post by Fluid Byte »

Christian wrote:So, PureBasic didn't use the Windows skinning library to draw the border in version 4.30? How was it done before?
Nothing was done :lol:

The EditorGadget always had a non-themed border (classic look) regardless of the theme settings in the compiler.
Christian wrote:Yes, I know that. But I didn't know that those changes also affect the way the PB Gadgets are drawn.
The EditorGadget is the only one I know of and it's only a little cosmetic fix.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Christian
Enthusiast
Enthusiast
Posts: 154
Joined: Mon Dec 08, 2003 7:50 pm
Location: Germany

Re: EditorGadget border and scrollbars

Post by Christian »

Fluid Byte wrote:Nothing was done :lol:
I created an EditorGadget in PB 4.30 again and saw that ... you're right. :lol:

I didn't recognize before that the border of the EditorGadget looked the same way in PB 4.30 regardless of the chosen option for the XP skin support (on or off). :oops:

Thanks for your explanations!

Regards,
Christian
Post Reply