https://vahidmy.blog.ir/post/677




Using the Dialog Editor  ....

 


Add / Insert a control


The same menu option ('Add') is used either to either INSERT or to ADD a new control:


If any control data line is selected, the new control is added at the end of template.


If no line is selected in main editor list, the new control is added at the end of template too.


But: If a blank line (separator) is selected, the new control is inserted at  this given place.


You cannot do anything with a Control until you define its ID.

 

An 'ID' -IDentifier-, is a number used to indentify each Control. If two Controls in a same Dialog have the same ID, only the first one will be accessed. 


>>> ID Zero does not exist. <<<




Moving/Sizing the controls


Three features are available for modifying the sizes and the positions of the Controls in a DialogBox:


Edit Controls    in the Editor Window: Just enter the Values you want.


Up and Down Controls: Definition of the Controls Positions and Dimensions.


Direct Mouse actions: The Left Mouse Button enables you with usual Drag and Drop. Right Mouse Button enables you with Size Drag.


The Mouse actions on the Control, directly inside the Edited Dialog are for quick and dirty drawing. Just take care of not moving a Control under another one. All Controls, in a Dialog have a Z order (the order the OS draws the various Windows). The Dialog Editor does not modify this Z order in order to avoid moving a control under another one, and it may become invisible. If this happens, recover a visible position with the other editing features. In a Dialog Template, the Z order is the one of the Controls creations (simply, Top-Down, in the List View).


Mouse actions cannot be applied to a New created Control until you define its ID.


If you use the Direct Mouse actions, ''fine tuning'' of dimension and position may be achieved faster with Up and Down Controls and Edit Controls .


Selecting a Control by Left or Right Click produces a move of the Dialog Editor to the corresponding Coordinates Edition.




Dialog Class record


See the example in Iczelion Tutorial / 10MainDialog / Dialog1.exe for the relations between the name you set in the dialog editor and how to use it in the class record of WindowClassStructure designed for api registerClass.




Menus in Dialogs


Menus and Dialogs are two separate resources Types. When the Dialog Editor offers you the possibility of editing a new menu, this is just 'friendly'... As it is possible to use one menu for several purposes, I didn't set any option in the Dialog Editor to erase a Dialog Menu. Instead, go in 'Resources / Menu / Delete a Menu'. There is a security there to prevent  accidental erasing of a menu used by a Dialog, that will adjust the Dialog Data if you confirm erasing.




Dialog saving


The RosAsm Dialog Editor may output the results either directly into the Resources (Resources Templates) or  onto the ClipBoard,  to be pasted as 'Memory Templates'. Resources dialogs functions have their 'twin' Functions:

    

call 'USER32.DialogBoxParam' , ...          ; for Resources_Templates.

call 'USER32.DialogBoxIndirectParam', ... ; for Memory_Templates.


For all common dialogs that do not need run time modifications, you should prefer the usual savings in resources.




Controls Equates


For driving your Dialog, you have to manage your ID's equates inside your source: You DO have to do it. Unlike the Menu Editor, the Dialog Editor cannot set these equates for you, for several reasons:


You are allowed to give the same ID number to several controls (for example several '2' - to be used as 'Cancel' Case with the same branching as default &ID_CANCEL -). IDs are not guaranteed unique.


You can give the same 'title' name to different controls and, in any case, there is no way for the editor to save equates names in resources.


Several dialog boxes may use the same set of IDs... And so on.


~~~~~~~