Page 1 of 1

big problem whit #PB_String_Numeric (flickering)

Posted: Sun Jan 09, 2011 4:35 pm
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.

Re: big problem whit #PB_String_Numeric (flickering)

Posted: Mon Jan 10, 2011 3:21 am
by Rook Zimbabwe
Are you massively redrawing that window for some reason? Are you attempting to skin the interface?

Re: big problem whit #PB_String_Numeric (flickering)

Posted: Mon Jan 10, 2011 1:23 pm
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

Re: big problem whit #PB_String_Numeric (flickering)

Posted: Mon Jan 10, 2011 11:26 pm
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.

Re: big problem whit #PB_String_Numeric (flickering)

Posted: Tue Jan 11, 2011 12:23 pm
by Tomi
oK tomi, when user Having insisted to use non-numeric characters this flickering will to intensify :D
before, i have same problem.