CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

pass data from dialog/frame to main form

General discussion

by fuandi » 02 Jun 2014 03:40

hi, i'm still beginner with cgdevtool and intraweb. I want to build an application that required to open a pop up window and pass a data/variable value back to main window. I guess I can do this with frame/dialog. But can anyone help me on how to do this ?

This is the scenario.
In the main form/window, I have empty edit box and a button. When i click the button, a pop up window/dialog appear, inside the pop up window there is a grid with list of country in the world, after I selected the the country and press ok button, pop up window will be closed and then the edit text in the main window will show the country that i selected.

In this case, I need to pass a string to the main window. How to do this ?
fuandi
 
Posts: 6
Joined: 23 May 2014 03:51

by Jorge Sousa » 02 Jun 2014 10:04

Hi

The simple way is to create the frame with the form as owner.

procedure TIWMyForm.DoSomething;
begin
MyFrame:= TMyFrame.Create(Self);
end;

And in the frame unit, add the form unit to the implementation uses clause, and typecast it.

implementation

uses
MyForm;

procedure TMyFrame.DoSomething;
var
Form: TMyForm;
begin
Form:= Owner as TMyForm;
end;
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by fuandi » 03 Jun 2014 03:00

hi support team, thanks for the reply.

I can't show my frame. Maybe I missed some configuration ?

These are the steps :

1. add frame into project by file > new > others > choose iwcgjqframe and iwcgjqdialog as frame type
2. on the button click event, i put this
var
FRM: TIWCGJQFrame2;
begin
FRM:= TIWCGJQFrame2.Create(Self);
FRM.Show;
end;


Note : I already set my google chrome to allow pop up for all
I also tried the demo project jqframedialog, i cant show the frame after click the button
fuandi
 
Posts: 6
Joined: 23 May 2014 03:51

by Jorge Sousa » 03 Jun 2014 10:45

That Kind of operation is not supported by Intraweb if the event is ajax

You have to set button.onclick.ajax=false or call

FRM.IWFrameRegion.AjaxReRender // == RenderRegionAsync(FRM.IWFrameRegion);
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by fuandi » 04 Jun 2014 02:40

still doesnt solve the problem.

I set ajax to true, and use this code

procedure TIWForm1.IWCGJQButton1JQButtonOptionsClick(Sender: TObject;
AParams: TStringList);
var
FRM: TIWCGJQFrame2;
begin

FRM:= TIWCGJQFrame2.Create(Self);
// FRM.Parent:= WebApplication.ActiveForm as TWinControl;
// FRM.Name:= CGFindUniqueComponentName(Self,'DlgFrm2');
FRM.IWFrameRegion.AjaxReRender;
end;


And when i set ajax to false, i put this code

procedure TIWForm1.IWCGJQButton1JQButtonOptionsClick(Sender: TObject;
AParams: TStringList);
var
FRM: TIWCGJQFrame2;
begin
FRM:= TIWCGJQFrame2.Create(Self);
FRM.Show;
end;


Both doesn't work. The frame doesn't show
fuandi
 
Posts: 6
Joined: 23 May 2014 03:51

by Jorge Sousa » 04 Jun 2014 09:27

Please submit a test case
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Jorge Sousa » 04 Jun 2014 09:47

You forgot to set a Parent

if Button OnClick.Ajax=False

FRM:= TIWCGJQFrame2.Create(Self);
FRM.Parent:= Self;

If Button OnClick.Ajax=True, add this

FRM.IWFrameRegion.AjaxReRender();

You don't need FRM.Show in Intraweb

And by the way: You didn't set a jqueryui theme in your demo.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Alexander Bulei » 05 Jun 2014 10:41

Hi,

cgdevtools_support wrote:And by the way: You didn't set a jqueryui theme in your demo.


Help topic: viewtopic.php?f=3&t=1366

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 fuandi » 05 Jun 2014 10:55

Thanks, followed your instruction and it's working already. :D
fuandi
 
Posts: 6
Joined: 23 May 2014 03:51


Return to General - Archive

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.