StringGadget graphical bug on 4 in width

Windows specific forum
User avatar
oakvalley
User
User
Posts: 76
Joined: Sun Aug 08, 2004 6:34 pm
Location: Norway
Contact:

StringGadget graphical bug on 4 in width

Post by oakvalley »

Hi,

Using PB5.60 (x86)

Code: Select all

OpenWindow(0,0,0,500,200,"bug width")
StringGadget(0,10,10,1,100,"")
StringGadget(1,100,10,2,100,"")
StringGadget(2,200,10,3,100,"")
StringGadget(3,300,10,4,100,"") ; this one adds a vertical white area?! Looks like a flag.
StringGadget(4,400,10,5,100,"")
Repeat
  event=WaitWindowEvent()
Until GetAsyncKeyState_($1b)

When width=4, there is a strange graphical bug that shows a vertical sized white bar. All the other width looks fine.

__________________________________________________
Code tags added
03.07.2017
RSBasic
Regards Stone Oakvalley
Currently @ PB 5.70
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: StringGadget graphical bug on 4 in width

Post by Fred »

Probably a windows issue, we don't do anything fancy for the stringgadget rendering
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: StringGadget graphical bug on 4 in width

Post by luis »

Uhm... something is not right.

The client areas of the edit controls (the API controls wrapped by StringGadget) in the program in the first post are:

1) 1x100
2) 2x100
3) 3x100
4) 0x96 (!!!)
5) 1x96 (???)

Note you can't even click in the 4th stringgadget, because there is no client area available.

Using an API only program using some edit controls directly, the client areas are

1) 1x100
2) 2x100
3) 3x100
4) 4x100
5) 5x100

as expected.

Code: Select all

Global hBrush = CreateSolidBrush_(GetSysColor_(#COLOR_BTNFACE))

; window procedure

Procedure WinProc (hWnd, Msg, wParam, lParam)
 Select Msg
    Case #WM_CLOSE
        DestroyWindow_(hWnd)     
    Case #WM_NCDESTROY
        DeleteObject_(hBrush)
        PostQuitMessage_(0)
        ProcedureReturn 0     
 EndSelect
 ProcedureReturn DefWindowProc_(hWnd, Msg, wParam, lParam)
EndProcedure

; window class

Classname$ = "MyApiWindow"

With wClass.WNDCLASSEX
    \cbsize  = SizeOf(WNDCLASSEX)
    \lpfnWndProc  = @WinProc()
    \hCursor  = LoadCursor_(0, #IDC_ARROW)
    \hbrBackground  = hBrush
    \lpszClassName  = @classname$
EndWith

RegisterClassEx_(@wClass)

; create window and process messages

WinStyle = #WS_CLIPSIBLINGS | #WS_CLIPCHILDREN
WinStyle | #WS_CAPTION | #WS_SYSMENU | #WS_MINIMIZEBOX
WinStyle | #WS_MAXIMIZEBOX | #WS_SIZEBOX

hWnd = CreateWindowEx_(0, Classname$, "bug width", WinStyle, 100, 100, 500, 200, 0, 0, 0, 0)

CreateWindowEx_(0, "EDIT", "", #WS_OVERLAPPED | #WS_CHILD | #WS_VISIBLE | #WS_GROUP | #WS_TABSTOP, 10, 10, 1, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(0, "EDIT", "", #WS_OVERLAPPED | #WS_CHILD | #WS_VISIBLE | #WS_GROUP | #WS_TABSTOP, 100, 10, 2, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(0, "EDIT", "", #WS_OVERLAPPED | #WS_CHILD | #WS_VISIBLE | #WS_GROUP | #WS_TABSTOP, 200, 10, 3, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(0, "EDIT", "", #WS_OVERLAPPED | #WS_CHILD | #WS_VISIBLE | #WS_GROUP | #WS_TABSTOP, 300, 10, 4, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(0, "EDIT", "", #WS_OVERLAPPED | #WS_CHILD | #WS_VISIBLE | #WS_GROUP | #WS_TABSTOP, 400, 10, 5, 100, hwnd, 0, 0 ,0)

ShowWindow_(hWnd,  #SW_SHOW)

While GetMessage_(msg.MSG, 0, 0, 0 )
    TranslateMessage_(msg)
    DispatchMessage_(msg)
Wend

UnregisterClass_(Classname$, GetModuleHandle_(#Null))
This is what I get on Win 7

PB window

Image

API window

Image
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: StringGadget graphical bug on 4 in width

Post by luis »

I made some further experiments.
Looks like my first test was not good enough or if you prefer I was wrong. :lol:
Using a win spying utility I was able to replicate all the styles used by the PB program and looks like it's not a PB bug.

Code: Select all

Global hBrush = CreateSolidBrush_(GetSysColor_(#COLOR_BTNFACE))

; window procedure

Procedure WinProc (hWnd, Msg, wParam, lParam)
 Select Msg
    Case #WM_CLOSE
        DestroyWindow_(hWnd)     
    Case #WM_NCDESTROY
        DeleteObject_(hBrush)
        PostQuitMessage_(0)
        ProcedureReturn 0     
 EndSelect 
 ProcedureReturn DefWindowProc_(hWnd, Msg, wParam, lParam)
EndProcedure

; window class

Classname$ = "MyApiWindow"

With wClass.WNDCLASSEX
    \cbsize  = SizeOf(WNDCLASSEX)
    \lpfnWndProc  = @WinProc()
    \hCursor  = LoadCursor_(0, #IDC_ARROW)
    \hbrBackground  = hBrush
    \lpszClassName  = @classname$
EndWith

RegisterClassEx_(@wClass)

; create window and process messages

WinStyle = #WS_CLIPSIBLINGS | #WS_CLIPCHILDREN
WinStyle | #WS_CAPTION | #WS_SYSMENU | #WS_MINIMIZEBOX 
WinStyle | #WS_MAXIMIZEBOX | #WS_SIZEBOX

hWnd = CreateWindowEx_(0, Classname$, "bug width", WinStyle, 100, 100, 500, 200, 0, 0, 0, 0)

EditStyle = #WS_OVERLAPPED | #WS_CHILD | #WS_VISIBLE | #WS_GROUP | #WS_TABSTOP

EditStyleEx = #WS_EX_LEFT | #WS_EX_LTRREADING | #WS_EX_RIGHTSCROLLBAR

;EditStyleEx = #WS_EX_CLIENTEDGE | #WS_EX_LEFT | #WS_EX_LTRREADING | #WS_EX_RIGHTSCROLLBAR


CreateWindowEx_(EditStyleEx, "EDIT", "", EditStyle , 10, 10, 1, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(EditStyleEx, "EDIT", "", EditStyle , 100, 10, 2, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(EditStyleEx, "EDIT", "", EditStyle , 200, 10, 3, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(EditStyleEx, "EDIT", "", EditStyle , 300, 10, 4, 100, hwnd, 0, 0 ,0)
CreateWindowEx_(EditStyleEx, "EDIT", "", EditStyle , 400, 10, 5, 100, hwnd, 0, 0 ,0)


ShowWindow_(hWnd,  #SW_SHOW)

While GetMessage_(msg.MSG, 0, 0, 0 )
    TranslateMessage_(msg)
    DispatchMessage_(msg)
Wend

UnregisterClass_(Classname$, GetModuleHandle_(#Null))

Run it as it is, and there is no bug.

But comment out the second version of the extended style, the one using #WS_EX_CLIENTEDGE and the "bug" it's there in the API version too.

So is it a problem due to the fact that using #WS_EX_CLIENTEDGE the sunken effect mess with client area ?
Last edited by luis on Fri Jun 23, 2017 12:01 am, edited 1 time in total.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: StringGadget graphical bug on 4 in width

Post by luis »

It's definitively the style.

Code: Select all


OpenWindow(0,0,0,500,200,"bug width")
StringGadget(0,10,10,1,100,"",  #PB_String_BorderLess)
StringGadget(1,100,10,2,100,"",  #PB_String_BorderLess)
StringGadget(2,200,10,3,100,"",  #PB_String_BorderLess)
StringGadget(3,300,10,4,100,"",  #PB_String_BorderLess)
StringGadget(4,400,10,5,100,"",  #PB_String_BorderLess)
Repeat
event=WaitWindowEvent()
Until event = #PB_Event_CloseWindow

Removing the border, and so the sunken border effect, the "bug" it's not there even in the PB version.

:shock:
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
oakvalley
User
User
Posts: 76
Joined: Sun Aug 08, 2004 6:34 pm
Location: Norway
Contact:

Re: StringGadget graphical bug on 4 in width

Post by oakvalley »

Heh, thanks for investigating. Problem is that when border is removed, I loose that 3d Bevel effect splitter line i was looking for :-)

I had to use 5 in value instead of 4 to get my 3d bevel splitter-ish line. For those who want to create a white flag style automatically for free without any additional code, they could use value 4, haha.

So, who's to blame, Bill Gates?

I'm running Windows 7, 64bit here.
Regards Stone Oakvalley
Currently @ PB 5.70
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: StringGadget graphical bug on 4 in width

Post by Fred »

yes, seems like a Windows issue
Post Reply