Text Size

Feature Request

Dialog Types

Request new features here

Moderators: jsp, Pharmhaus

Dialog Types

Postby matibee » Wed May 02, 2012 11:17 pm

I'd like to be able to format the code as a Type instead of a page of global stuff 8)

That would mean..

Code: Select all
Type GetaTypeNameFromTheProject
  ' global declarations go here
  Global gadget1:
  Global gadget2:


  ' An initialisation funtion
  Function Init( parentwindow:TGadget )
    ' All the gadget creation code goes in here

  End Function

  ' An event handler function
  Function eventHandler:Object( pID%, pData:Object, pContext:Object )
    ' The message loop goes in here with some small tweaks
    ' ie
    Local event:TEvent = TEvent(pData)
      If ( event <> Null )
        Select event.id  ' must use event.id / event.data etc NOT EventData() or EventID()



  End Function

  ' The usual gadget action code follows


End Type


I come from a background in MFC and I'm used to (and quite like) organising code into 'Dialog Classes' as they're called. It's not to difficult to rearrange the current output but there are some subtle differences that make it more than just a copy + paste exercise.

Of course the example above is for a singleton class, I'm not sure instances of these dialogs would be a good idea.

Anyway thanks guys for such a great tool. It's extremely powerful, flexible and thorough and I can see a lot of work went into it. It's been worth every penny and I've only made one dialog! (Although it does have about 40 gadgets spread over 4 panels and 4 tabs.)

Cheers
Matt
matibee
New Member
 
Posts: 5
Joined: Thu Apr 26, 2012 7:58 pm

Re: Dialog Types

Postby jsp » Thu May 03, 2012 11:08 am

Hi Matt,
what you are may missing is the checkbox for type creation in Logic Gui.
You can find it in the Properties Editor/Application/Gadgets -> Type creation.
Check this box and you form will be converted. (make a backup if you never used it before)

Type Creation:
Independent types are generated for every window when enabled. The name of the type is generated by the window gadget name and the window extend (comment field). For example: the window gadget name is Win1 the resulting type would be 'TWin1'. The type extend (comment field) can be used for additional keywords, for instance to extend the type: 'Twin1 Extends TForm'.
When switching on the type creation the default variable type for new added gadgets is changed to 'Field' if it was 'Local' before and vice versa. If your default variable type is 'Global' nothing is changed and you need to take care yourself.
When switching between type creation and the classical WaitEvent() loop, Logic Gui will check the variable types. A requester will show up when 'Locals' or 'Globals' are found and may should be converted to 'Field' or vice versa. Ok, does the conversion and Cancel leaves it to your responsibility to have the right variable type for the chosen workflow.
An extra dialogue pops up when switching on the type creation, but your TForm Management type is still off (and lets you turn it on). Also the WorkSpace window will be forced to off. The TForm type will be automatically imported when Logic Gui type creation is enabled and the TForm type is chosen in the types tab. When you add a new window to the form, this window will automatically get the "Extends TForm" applied in comment textfield. Existing windows with 'no comments yet' get also the "Extends TForm" applied in comment textfield. This should save some typing and may help not to forget to define a window manager.


This is probably not for every user, thus the default is the good old WaitEvent() loop.
When creating types out of your dialogs (you can have types out of windows and panels with your dialog stuff on top) a lot more things are possible.

First of all all types are automatically extended from a base class, which does all the event routing between the different dialogs in MaxGUI for you.
And second it adds an OOP interface/commands to your form which makes it easier to handle.

Check out the user manual:
12.2 Create Independent Window and Panel Types

Inside a type (TForm) things must handled a bit different, thus read also:
7.1.3.4 TForm

When you want to build your own base class check out also:
8.2.4.8 Types Tab

When you do use the internal editor at least for some basic stuff, remember there is a sort of command intellisense, this is also useful for the for the OOP TForm commands, because this is something forgotten quickly:
Have a look at page 153 in the user manual of version 5.5

And at the end the explanation of the TForm type
13.2 TForm
Getters / Setters and so on...

And for advanced users of the advanced users may also the reflection section:
12.3 Reflection

Ok, that's a lot I know, but I think you will get it quickly how it works when reading the concept behind.
In the Examples folder of the the distribution you will find also some type related forms, just import them and have a look.

When you have further questions just post them...
User avatar
jsp
LogicZone
 
Posts: 372
Joined: Sun Sep 09, 2007 11:18 pm
Location: Germany

Re: Dialog Types

Postby matibee » Thu May 03, 2012 8:27 pm

You really have thought of everything. I must admit I didn't understand what the TForm option tab was doing other than killing the BMax compiled preview. I now understand how it's a dialog type that needs instantiating.

Great job. I'll let you know how I get on.

Thanks,
Matt
matibee
New Member
 
Posts: 5
Joined: Thu Apr 26, 2012 7:58 pm


Return to Feature Request

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Menu

Login form



Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 71 on Fri Apr 08, 2016 9:16 pm

Users browsing this forum: No registered users and 1 guest