Page 1 of 1

What does UseGadgetList() exactly do?

Posted: Sat Sep 22, 2012 5:41 pm
by eriansa
Stupid question you think?

Well, I sometimes get an IMA on this function.
I've PM'ed Fred about this in a long mail. But didn't get any response.

So what I lke to know is what could be a reason for this IMA.

(the context is a VST-plugin (dll) that works in most DAW's but not in Reaper, this plugin gets a hWnd from the host and thus can add gadgets to the provided window)

Tia.

Re: What does UseGadgetList() exactly do?

Posted: Sat Sep 22, 2012 6:09 pm
by falsam

Code: Select all

Enumeration
  #Form1
  #Form2
EndEnumeration

Define.l Event, WEvent, MEvent, GEvent, TEvent

Global WindowStyle.i=#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered

Procedure Open_MainForm()
  OpenWindow(#form1, 0, 0, 500, 400, "New Form", WindowStyle)
  OpenWindow(#form2, 0, 0, 300, 300, "New Form", #PB_Window_ScreenCentered)
  
  UseGadgetList(WindowID(#form1))
  ButtonGadget(#PB_Any, 10, 10, 80, 23, "Button 1")
  
  UseGadgetList(WindowID(#form2))
  ButtonGadget(#PB_Any, 10, 40, 80, 23, "Button 2")
    
EndProcedure

Open_MainForm()


Repeat
  Event  = WaitWindowEvent(10)
  WEvent = EventWindow() 
  MEvent = EventMenu()
  GEvent = EventGadget()
  TEvent = EventType()
  Select Event
    Case #PB_Event_Gadget
      Select GEvent
      EndSelect
        
    Case #PB_Event_CloseWindow
      End
  EndSelect
ForEver
Commented lines UseGadgetList(.....) and run.

For a single window, UseGadgetList() is not necessary.

Re: What does UseGadgetList() exactly do?

Posted: Sun Sep 23, 2012 10:48 am
by eriansa
I know how to use UseGadgetList().
(I am programming computers for over 30 years...)

The question is what exactly does the asm statement

CALL _PB_UseGadgetList@4

do?

I mean what could be the reason for an IMA in that asm statement?

Surely I could post the sources. But you need to test it in Reaper (http://cockos.com/)
The strange thing is that my plugin works in all other hosts except Reaper. (the first time the plugin is loaded, everything is ok, but the second time CRASH!)

Hopefully Fred/Freak can tell me what is done in "_PB_UseGadgetList@4".

I know it's a strange issue, but it prevents me from releasing my VST-Template for PureBasic...

So please, Fred/Freak, enlighten me on this issue :?