[Done] MDIGadget + StringGadget + Numeric = MDI destroyed

Post bugreports for the Windows version here
User avatar
bamsagla
User
User
Posts: 62
Joined: Sat Jan 30, 2010 10:10 am
Location: Laufen, Bavaria, Germany

[Done] MDIGadget + StringGadget + Numeric = MDI destroyed

Post by bamsagla »

Hi everyone,

if I remember correctly, some time ago a similar problem has been described somewhere. Maybe it was marked as Done, but one problem remains.
The following example code creates a simple window with MDI-window including one StringGadget with the parameter #pb_string_numeric. If you touch a wrong key ONE time, windows displays his "Oh my god - you touched a wrong key...". But the SECOND and even more times you touch wrong keys (like alphabetic keys...) the message remains intact but some parts of the MDI are becoming "destroyed" (not redrawn), like parts of the light red background color and parts of the TextGadget...

Try for yourself (I tried on Windows 7 x64 with PB 5.00 and PB 5.11b2):

Code: Select all

Define.i Wd, Sw, Md, Ev, Fi
Wd = OpenWindow(#PB_Any, 0, 0, 600, 400, "Test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
If Not Wd = 0
	SetWindowColor(Wd, RGB(255, 255, 255))
	If CreateMenu(#PB_Any, WindowID(Wd))
		OpenSubMenu("Window")
		Md = MDIGadget(#PB_Any, 0, 0, 400, 300, 0, 0, #PB_MDI_AutoSize)
		If Not Md = 0
			Sw = AddGadgetItem(Md, #PB_Any, "MDI-Test")
			If Not Sw = 0
				ResizeWindow(Sw, #PB_Ignore, #PB_Ignore, 400, 300)
				SetWindowColor(Sw, RGB(255, 100, 100))
				StringGadget(#PB_Any, 20, 20, 100, 25, "", #PB_String_Numeric)
				TextGadget(#PB_Any, 20, 45, 300, 25, "Please enter non-numeric values above!")
				Repeat
					Test = WaitWindowEvent(5000)
					Select Test
						Case #PB_Event_CloseWindow: Fi = 1
					EndSelect
				Until Fi = 1
			EndIf
		EndIf
	EndIf
EndIf
End
Remember to type wrong values inside the StringGadget more than once.

Thanks for testing and responses, bamsagla.

Edit: Forgot to mention that everything works fine for me without MDI-Window (numeric StringGadget inside a simple window).
Edit2: Just for reviewing purposes - the Isxxx()-commands have been replaced by If-statements as Fred suggested.
Last edited by bamsagla on Tue Mar 12, 2013 3:08 pm, edited 1 time in total.
- Sherlock Holmes - "When you have eliminated the impossible, whatever remains, however improbable, must be the truth."
In my opinion, he must have been a programmer.
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: MDIGadget + StringGadget + Numeric = MDI partially destr

Post by Fred »

Fixed. BTW, don't use IsXXX() functions if not absolutely necessary as they are time consuming. #PB_Any returns 0 if it can't be created, so a regular IF is enough.
User avatar
bamsagla
User
User
Posts: 62
Joined: Sat Jan 30, 2010 10:10 am
Location: Laufen, Bavaria, Germany

Re: [Done] MDIGadget + StringGadget + Numeric = MDI destroye

Post by bamsagla »

Hi Fred,
thanks for fixing and also thanks a lot for this hint.
That was a typical "validating the value of the value"... :oops:
Why creating easy code if there's a possibility for complicating things...? :twisted:
*fail with BOD*
Merci, bamsagla.
- Sherlock Holmes - "When you have eliminated the impossible, whatever remains, however improbable, must be the truth."
In my opinion, he must have been a programmer.
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: MDIGadget + StringGadget + Numeric = MDI destroyed

Post by Fred »

Reverted back hacks, so this bug is back.
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: MDIGadget + StringGadget + Numeric = MDI destroyed

Post by Fred »

Seems to work as expected in current version, can anyone else confirm ?
Post Reply