big problem whit #PB_String_Numeric (flickering)

Just starting out? Need help? Post your questions and find answers here.
+18
Enthusiast
Enthusiast
Posts: 228
Joined: Fri Oct 24, 2008 2:07 pm

big problem whit #PB_String_Numeric (flickering)

Post by +18 »

Hi
I need a numeric string input whit 1000 digit separator. for example : 2,002,152 , 25.000 , ...etc
i have a big problem whit #PB_String_Numeric (#ES_NUMBER) whenever my stringggadget is in panel it has a big flickering, else it has a weak flickering always.
because if user input a non numerical digit into stringgadget, we will see a flickering that extended to all window.

i try this :

Code: Select all

 Global Number.s="0123456789"
Procedure Numeric()
    Change$ = GetGadgetText(0)
           For i=1 To Len(Number)
               For j=1 To Len(Change$)
                    If  FindString(Number, Mid(Change$, j, 1), 0)   = 0 : SetGadgetText(0, RemoveString(Change$, Mid(Change$, j, 1)) ) : SendMessage_(GadgetID(0), #EM_SETSEL, $FFFF, $FFFF)  : EndIf
               Next
           Next
 EndProcedure
If OpenWindow(0, 0, 0, 230, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    StringGadget(0,50,50,100,25,"")
   
    
    
    Repeat
       Event = WaitWindowEvent()
       
       Select Event
       
         Case #PB_Event_Gadget
             
           Select EventGadget()
             Case 0
               Select EventType()
                   Case #PB_EventType_Change : Numeric()
               EndSelect
            EndSelect
;         Case #WM_CHAR :Numeric()   
       EndSelect
     Until Event = #PB_Event_CloseWindow
  EndIf

1- have u a better tip?
2- can u improvement this code?
3- can u add any 3-Digit separator .(useful for currency ).
4- in above code i don't have any control on Paste event.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: big problem whit #PB_String_Numeric (flickering)

Post by Rook Zimbabwe »

Are you massively redrawing that window for some reason? Are you attempting to skin the interface?
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
+18
Enthusiast
Enthusiast
Posts: 228
Joined: Fri Oct 24, 2008 2:07 pm

Re: big problem whit #PB_String_Numeric (flickering)

Post by +18 »

yes i have some redraws and use panel for main body, even in this small code u will see some flikering if use non numeric digits in string input (Oh ever if we have big code!):

Code: Select all

 If OpenWindow(0, 0, 0, 322, 220, "FlickeringGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    PanelGadget     (0, 8, 8, 306, 203)
      AddGadgetItem (0, -1, "Panel 1")
        StringGadget(1, 8,  35, 306, 20, "1234567", #PB_String_Numeric)
        CloseGadgetList()
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
i think fred will improve this case in next version! (The grace of God)
So far for this time, if somebody have a tip, please me :D
User avatar
charvista
Addict
Addict
Posts: 949
Joined: Tue Sep 23, 2008 11:38 pm
Location: Belgium

Re: big problem whit #PB_String_Numeric (flickering)

Post by charvista »

Sorry, but I don't see any flickering in this small code. (PB4.51 64bit on Win7 64-bit)
The only flickering I see is the balloon flickering if you are typing non-numeric characters (one flickering for each wrong keystroke) but that's normal
You will probably need to provide more code.
PS: your stringgadget was going over the panel, you defined the panel 306px long, and your stringgadget is also 306px long, but starting at pos 8. Make it so that it doesn't go over the panel and then probably your flickering will disappear.
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
User avatar
Tomi
Enthusiast
Enthusiast
Posts: 270
Joined: Wed Sep 03, 2008 9:29 am

Re: big problem whit #PB_String_Numeric (flickering)

Post by Tomi »

oK tomi, when user Having insisted to use non-numeric characters this flickering will to intensify :D
before, i have same problem.
Post Reply