Page 1 of 2

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

Posted: Thu Feb 28, 2013 12:04 pm
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

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

Posted: Thu Feb 28, 2013 12:18 pm
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

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

Posted: Thu Feb 28, 2013 12:41 pm
by luciano
thanks Fred for replying, but doing this way the drop down is empty.

Image

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

Posted: Thu Feb 28, 2013 1:46 pm
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

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

Posted: Thu Feb 28, 2013 7:13 pm
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).

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

Posted: Thu Feb 28, 2013 7:57 pm
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.

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

Posted: Thu Feb 28, 2013 10:26 pm
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

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

Posted: Sat Mar 02, 2013 12:47 pm
by Polo
I'll see what I can do, I move the topic to the designer forum so I don't forget!

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

Posted: Sat Mar 02, 2013 9:44 pm
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!

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

Posted: Sat Mar 02, 2013 11:15 pm
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?

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

Posted: Sat Mar 02, 2013 11:46 pm
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!

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

Posted: Sun Mar 03, 2013 12:00 am
by luciano
No problem, I used SetGadgetText in the main file and the text is ok.
:)

Image

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

Posted: Sun Mar 03, 2013 12:07 am
by Polo
It's really nice what you've been able to do with the designer :)

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

Posted: Sun Mar 03, 2013 1:27 am
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

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

Posted: Mon Mar 11, 2013 8:50 pm
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.