SmartWindowRefresh() vs. ImageGadget() / SetGadgetState()

Just starting out? Need help? Post your questions and find answers here.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

SmartWindowRefresh() vs. ImageGadget() / SetGadgetState()

Post by nco2k »

Code: Select all

If OpenWindow(0, 0, 0, 245, 105, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
  SmartWindowRefresh(0, #True)
  icon1 = ExtractIcon_(0, "shell32.dll", 8)
  icon2 = ExtractIcon_(0, "shell32.dll", 6)
  ImageGadget(0, 10, 10, 32, 32, icon1)
  ButtonGadget(1, 10, 47, 100, 25, "Click")
  icon = 1
  Repeat
    WinEvent = WaitWindowEvent()
    If WinEvent = #PB_Event_Gadget And EventGadget() = 1
      Select icon
        Case 1
          SetGadgetState(0, icon2)
          icon = 2
        Case 2
          SetGadgetState(0, icon1)
          icon = 1
      EndSelect
    EndIf
  Until WinEvent = #PB_Event_CloseWindow
EndIf : End
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Na du? das Problem habe ich schon im german Forum angesprochen... Es wäre außerdem für nicht-eingeweihte hilfreich, würdest du ein kurzes Statement dazu abliefern.

@ all: nco2k is aiming at the window-refresh failing. I already discovered this bug in the german forum. There should be a workaround: Assign zero (0) to the ImageGadget(), and the previosly showed Image should disappear (says the PB helpfile). But this does not work!!!!! :(
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Errrm...
The mighty manual wrote:Enable a smart way to refresh the window to reduce the flickering when resizing the window. If the window isn't resizable, the command isn't needed.
Simply disable smart refresh when you're not resizing the window.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

Fluid Byte wrote:Errrm...
The mighty manual wrote:Enable a smart way to refresh the window to reduce the flickering when resizing the window. If the window isn't resizable, the command isn't needed.
Simply disable smart refresh when you're not resizing the window.
funny, but i need the window to be resizable so i cant/wont disable it. :roll:

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

funny, but i need the window to be resizable so i cant/wont disable it.
Now where again you mentioned that in your post.... :roll:

And yes, you can enable/disable it in a simple response to #WM_SIZE respectivley #WM_SIZING or similar.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

@Fluid Byte
> Now where again you mentioned that in your post....
i am reporting a bug of a command, which is responsible for smarter refreshing when resizing a window?! i think that is self explaining for every half way intelligent human being. i havent put #PB_Window_SizeGadget inside my example code, to show that it doesnt work correctly even if not resizing the window.

> And yes, you can enable/disable it in a simple response to #WM_SIZE respectivley #WM_SIZING or similar.
i think #WM_ENTERSIZEMOVE & #WM_EXITSIZEMOVE is the better way to go. but even so, it wont work as expected without manually refreshing the window again and where is the point in using SmartWindowRefresh() if i have to refresh the window anyway by myself?! whats "smart" about that??

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Just my 2 cents:

1.) You need to show us that smart refresh doesn't work with fixed-size windows, it's not meant for that. Regardless wether it's working or not. Just disable it.

2.) It really doesn't make a difference if you use #WM_ENTERSIZEMOVE, #WM_SIZING or something else. Just wanted to let you know that you can control the on/off status of smart refresh by catching a specific callback message.

PS: I am using smart refresh too in some project and it's working fine but I'm not using it with tranparent icon's.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Post Reply