[Done] 5.11-B1 Form Designer: File with event procedures ?

You need some new stunning features ? Tell us here.
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

[Done] 5.11-B1 Form Designer: File with event procedures ?

Post by luciano »

I don't know if it happens only in windows version, but I cannot find a way to include a file with event procedures in Form Designer.
If I manually add in code an "Xinclude" it will be removed, maybe there is some input somewhere but I did not find it.
Using XP sp3 32 bit
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by Fred »

You need to do the other way around: you include your form and put your event procedure where you want (but not in the form file). Take a look here: http://www.purebasic.com/documentation/ ... _form.html
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by luciano »

thanks Fred for replying, but doing this way the drop down is empty.

Image
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by luciano »

I did a simplified form and main file to check
TEST_Main.pb:

Code: Select all


  XIncludeFile "MainWindow.pbf" ; Include the second window definition
  
  OpenMainWindow() ; This procedure name is always 'Open' followed by the window name
  
  
  ; The event procedures, as specified in the 'event procedure' property of each gadget
  Procedure OkButtonEvent(EventType)
    Debug "OkButton event"
  EndProcedure
  
  Procedure CancelButtonEvent(EventType)
    Debug "CancelButton event"
  EndProcedure
  
  Procedure TrainCalendarEvent(EventType)
    Debug "TrainCalendar event"
  EndProcedure
  
  
  
  ; The main event loop as usual, the only change is to call the automatically
  ; generated event procedure for each window.
  Repeat
    Event = WaitWindowEvent(10)
    
    ;Select EventWindow()
     ; Case MainWindow
        MainWindow_Events(Event) ; This procedure name is always window name followed by '_Events'
        
;       Case DateWindow
;         DateWindow_Events(Event)
        
    ;EndSelect
    
  Until Event = #PB_Event_CloseWindow ; Quit on any window close
and the form
MainWindow.pbf

Code: Select all

Global MainWindow

Enumeration #PB_Compiler_EnumerationValue
  #Button_0
  #Button_1
EndEnumeration

Declare CancelButtonEvent(EventType)
Declare OkButtonEvent(EventType)

Procedure OpenMainWindow()
  MainWindow = OpenWindow(#PB_Any, 0, 0, 330, 280, "MainWindow", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  ButtonGadget(#Button_0, 80, 45, 155, 65, "Cancel")
  ButtonGadget(#Button_1, 80, 130, 155, 65, "Ok")
EndProcedure

Procedure MainWindow_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Button_0
          CancelButtonEvent(EventType())          
        Case #Button_1
          OkButtonEvent(EventType())          
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure
But the combo at EventProcedure is still empty and the procedure name has to be inserted manually even if there are 2 procedures declared in the .pbf file
edit: added picture:
Image
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by Fred »

I think it shouldn't be a combobox anymore, you have to enter your procedure name (you hardly reuse twice the same procedure anyway).
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by luciano »

Thank you for your prompt reply, I admit that seeing the combo, I thought that I was missing some setting.
Now that we know that, after all we can copy and paste the procedure names from the main file directly to Form Designer.
You are right that in practice we hardly ever reuse the same procedure twice, but choosing from an automatically populated combobox was more ...ehm.. "visual".
Keep on the good work and thanks for the continuos updates to you and the team.
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by PMV »

If you need to enter the procedure-name.
Wouldn't it be more comfortable to select
one of the existing procedures?

The IDE knows all existing procedures, so
the FormDesigner should be able to get this
information, too? Would be really handy.

MFG PMV
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by Polo »

I'll see what I can do, I move the topic to the designer forum so I don't forget!
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by Polo »

Ok, it should now display all procedures from opened files in the IDE.
Let me know if that works fine when next beta is released!
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: [Done] 5.11-B1 Form Designer: File with event procedures

Post by luciano »

Thank you, I will test it surely.

I have a quick question in the meantime, I had to paste Turkish text (unicode) as caption, is there a way to accept unicode?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: [Done] 5.11-B1 Form Designer: File with event procedures

Post by Polo »

Everything should be ready to support unicode on the form designer side, but some procedures in the IDE are not compatible with unicode so for now it is not supported!
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: [Done] 5.11-B1 Form Designer: File with event procedures

Post by luciano »

No problem, I used SetGadgetText in the main file and the text is ok.
:)

Image
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: [Done] 5.11-B1 Form Designer: File with event procedures

Post by Polo »

It's really nice what you've been able to do with the designer :)
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: 5.11-B1 Form Designer: File with event procedures ?

Post by PMV »

Polo wrote:Ok, it should now display all procedures from opened files in the IDE.
Let me know if that works fine when next beta is released!
nice!
Polo wrote:Everything should be ready to support unicode on the form designer side, but some procedures in the IDE are not compatible with unicode so for now it is not supported!
Is it a big thing or can we hope for that support in one of the next release?
I speak about hope, not a final date. :mrgreen:

MFG PMV
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: [Done] 5.11-B1 Form Designer: File with event procedures

Post by luciano »

Polo wrote:Ok, it should now display all procedures from opened files in the IDE.
Let me know if that works fine when next beta is released!
It works nicely, thank you.
Post Reply