What does UseGadgetList() exactly do?

Just starting out? Need help? Post your questions and find answers here.
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

What does UseGadgetList() exactly do?

Post 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.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 644
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: What does UseGadgetList() exactly do?

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

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

Re: What does UseGadgetList() exactly do?

Post 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 :?
Post Reply