It is currently Tue Jun 18, 2019 7:55 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: MDIGadget + StringGadget + Numeric = MDI destroyed
PostPosted: Mon Mar 11, 2013 8:08 pm 
Offline
User
User
User avatar

Joined: Sat Jan 30, 2010 10:10 am
Posts: 62
Location: Laufen, Bavaria, Germany
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:
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.

_________________
- 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.


Last edited by bamsagla on Tue Mar 12, 2013 3:08 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: MDIGadget + StringGadget + Numeric = MDI partially destr
PostPosted: Tue Mar 12, 2013 10:56 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13590
Location: France
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] MDIGadget + StringGadget + Numeric = MDI destroye
PostPosted: Tue Mar 12, 2013 11:06 am 
Offline
User
User
User avatar

Joined: Sat Jan 30, 2010 10:10 am
Posts: 62
Location: Laufen, Bavaria, Germany
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: MDIGadget + StringGadget + Numeric = MDI destroyed
PostPosted: Sat Nov 09, 2013 4:02 pm 
Offline
Administrator
Administrator

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye