CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Dialog created dynamicaly

General discussion

by assapan » 07 Oct 2015 16:03

Hi,
i'd like to create some dialogs dynamicaly because i want to control the number of buttons , language and so on ..
So i took the JQMobileDemoIW14 sources and particularily JQMProducts form so i see in the DFM

Code: Select all
  object JQMCustomDialog: TIWCGJQMRegion
    Left = 120
    Top = 136
    Width = 201
    Height = 244
    TabOrder = 1
    Version = '1.0'
    RegionType = jqmrtPage
    object IWCGJQMPageHeader1: TIWCGJQMPageHeader
      Left = 0
      Top = 0
      Width = 201
      Height = 43
      TabOrder = 0
      Version = '1.0'
      JQMPageHeaderOptions.Position = jqmdpInline
      JQMPageHeaderOptions.Caption = 'Purchase'
      JQMPageHeaderOptions.Role = 'header'
    end
    object IWCGJQMRegion3: TIWCGJQMRegion
      Left = 0
      Top = 43
      Width = 201
      Height = 201
      TabOrder = 1
      Version = '1.0'
      Align = alClient
      RegionType = jqmrtContent
      object JQMCDLbl: TIWCGJQMLabel
        Left = 0
        Top = 0
        Width = 201
        Height = 32
        TabOrder = 0
        Version = '1.0'
        Text = 'Label'
        LabelOptions.GoogleMapOptions.Parameters = <>
      end
      object IWCGJQMButton1: TIWCGJQMButton
        Left = 0
        Top = 90
        Width = 201
        Height = 58
        TabOrder = 2
        Version = '1.0'
        JQMButtonOptions.Label_ = 'Cancel'
        JQMLinkingOptions.RelType = jqmrtBack
      end
      object IWCGJQMButton: TIWCGJQMButton
        Left = 0
        Top = 32
        Width = 201
        Height = 58
        TabOrder = 1
        Version = '1.0'
        JQMButtonOptions.Theme = 'b'
        JQMButtonOptions.Events.OnVClick.Ajax = False
        JQMButtonOptions.Events.OnVClick.OnEvent = IWCGJQMButton2JQMButtonOptionsEventsVClick
        JQMButtonOptions.Label_ = 'Purchase'
      end
    end
  end

so i tried to reproduce the same construction

Code: Select all
class function TJQMobileDialog.CreeDialog(AOwner: TComponent; ACaption: String; Buttons: SetOfButtons): TJQMobileDialog;
var
  i: TMDButtons;
  region : TIWCGJQMRegion;
  Header : TIWCGJQMPageHeader;
begin
  Result := TJQMobileDialog.Create(AOwner);
  Result.Parent:=AOwner as TWinControl;
  Result.Name:=CGFindUniqueComponentName(AOwner,'dialog');
  Result.Align:=alNone;

  Region:=TIWCGJQMRegion.Create(Result);
  region.Parent:=Result;
  region.Name:=CGFindUniqueComponentName(AOwner,'region');
  region.RegionType:=jqmrtContent;

  Header:=TIWCGJQMPageHeader.Create(Region);
  Header.Parent:=region;
  Header.JQMPageHeaderOptions.Caption:=ACaption;

  for i := Low(TMDButtons) to High(TMDButtons) do
  begin
    if i in Buttons then
    begin
      with Result do
      begin
        FButtons[i] := TIWCGJQMButton.Create(region);
        FButtons[i].Parent:=region;
        FButtons[i].Name := CGFindUniqueComponentName(region,'bouton');
        case i of
          mdYES:
            FButtons[i].Caption := GetTraduction(Commun_oui);
          mdNO:
            begin
              FButtons[i].Caption := GetTraduction(Commun_non);
              FButtons[i].JQMLinkingOptions.RelType:=jqmrtBack;
            end;
        end;
      end;
    end;
  end;
end;


so my problem is , this dialog is rendered first in the html so it overtake the normal page ( id="DIALOG" is my creation :oops: )
Code: Select all
              <div data-url="DIALOG" data-role="page" id="DIALOG">
            <div data-role="content" id="REGION">
                <div data-role="header"><h1>Dialog Valider</h1></div>
                <a data-role="button" id="BOUTON">oui</a>
                <a data-role="button" data-rel="back" id="BOUTON1">non</a></div></div>
        <div data-url="IWCGJQMPAGE" data-role="page" id="IWCGJQMPAGE">
            <div data-role="header" id="IWCGJQMHEADER"><a id="IWCGJQMHEADER_LeftButton" class="ui-btn-left" data-enable="true" data-icon="back" data-rel="back"></a><h1>Infos Reservation</h1></div>
            <div data-role="content" id="IWCGJQMCONTENT">
                <a data-role="button" href="#JQMCUSTOMDIALOG" data-rel="dialog" id="IWCGJQMBUTTON2">Test dialog</a>
                <a data-role="button" id="BTMONDIALOG">Mon dialog</a></div></div>
        <div data-url="JQMCUSTOMDIALOG" data-role="page" id="JQMCUSTOMDIALOG">
            <div data-position="inline" data-role="header" id="IWCGJQMPAGEHEADER1"><h1>Purchase</h1></div>
            <div data-role="content" id="IWCGJQMREGION3">
                <div id="JQMCDLBL">
                    <label id="JQMCDLBL_JQM">Label</label></div>
                <a data-role="button" id="IWCGJQMBUTTON" data-theme="b">Purchase</a>
                <a data-role="button" data-rel="back" id="IWCGJQMBUTTON1">Cancel</a></div></div><form method="POST" name="SubmitForm" action="/$/">
            <input type="hidden" name="IW_FormName" value="FrmMobileInfosReservations">
            <input type="hidden" name="IW_FormClass" value="TFrmMobileInfosReservations"></form></body></html>



How can i force my dialog to be created last ?
Want to visit Ardeche http://leclosdelarc.fr/index.php
The Pont d’Arc Cavern http://en.cavernedupontdarc.fr
Image
User avatar
assapan
 
Posts: 600
Joined: 16 Dec 2013 12:04
Location: France

by Alexander Bulei » 07 Oct 2015 17:18

Hi assapan,

Use the TabOrder ;)

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by assapan » 07 Oct 2015 17:44

So stupid :oops:

It works thanks
Want to visit Ardeche http://leclosdelarc.fr/index.php
The Pont d’Arc Cavern http://en.cavernedupontdarc.fr
Image
User avatar
assapan
 
Posts: 600
Joined: 16 Dec 2013 12:04
Location: France


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.