Page 1 of 1

EditorGadget border and scrollbars

Posted: Fri Apr 16, 2010 6:52 am
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

Re: EditorGadget border and scrollbars

Posted: Fri Apr 16, 2010 9:53 am
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


Re: EditorGadget border and scrollbars

Posted: Sat Sep 11, 2010 6:29 pm
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

Re: EditorGadget border and scrollbars

Posted: Sat Sep 11, 2010 6:45 pm
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

Re: EditorGadget border and scrollbars

Posted: Sun Sep 12, 2010 7:29 pm
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!

Re: EditorGadget border and scrollbars

Posted: Sun Sep 12, 2010 10:00 pm
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.

Re: EditorGadget border and scrollbars

Posted: Sun Sep 12, 2010 10:30 pm
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.

Re: EditorGadget border and scrollbars

Posted: Sun Sep 12, 2010 10:37 pm
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.

Re: EditorGadget border and scrollbars

Posted: Sun Sep 12, 2010 11:01 pm
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