CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Resize region at runtime

by George » 27 Sep 2013 21:02

Hi, dear CG :)

I discovered, that region may be moved at run time (drag and drop).
(unfortunately, "left" and "top" property does not updates).
pascal code
procedure TIWForm1.IWCGJQRegion1JQDragOptionsStop(Sender: TObject; AParams: TStringList);
begin
IWCGJQLabel1.Caption := IWCGJQRegion1.Left.ToString();
end;


Maybe you can add resize options like: Disabled, toLeft, toRight etc.. ?
Or may be you have any advices. At this moment, i'm think about implementing some JS and CSS from jQUERY UI demo.
I want make interactive widgets based on regions with custom user positions and sizes.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 27 Sep 2013 21:50

Hi dear George :)

All cgdevtools controls have JQResizeOptions, at least public property, not always published.

I just don't find toLeft, toRight maybe this is JQPositionOptions?

Other common properties:

property JQDragOptions: TIWCGJQDragOptions read GetJQDragOptions write SetJQDragOptions stored IsJQDragOptionsStored;
property JQDropOptions: TIWCGJQDropOptions read GetJQDropOptions write SetJQDropOptions stored IsJQDropOptionsStored;
property JQResizeOptions: TIWCGJQResizeOptions read GetJQResizeOptions write SetJQResizeOptions stored IsJQResizeOptionsStored;
property JQEffects: TIWCGJQEffects read GetJQEffects write SetJQEffects stored IsJQEffectsStored;
property JQPositionOptions: TIWCGJQPositionOptions read GetJQPositionOptions write SetJQPositionOptions stored IsJQPositionOptionsStored;

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

by George » 28 Sep 2013 11:44

JQResizeOptions is exactly what I need.
I just don't find toLeft, toRight maybe this is JQPositionOptions?
No, i mean allowed resize directions. I suppose, i can control this through IWCGJQRegion3.JQResizeOptions.Handles.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by George » 28 Sep 2013 17:37

(unfortunately, "left" and "top" property does not updates).

Found way to get correct values :)
pascal code
procedure TwForm1.SetDragOptions();
begin
wRegion1.JQDragOptions.Disabled := False;
wRegion1.JQDragOptions.OnStop.OnEvent := wRegion1JQDragOptionsStop;
wRegion1.JQDragOptions.OnStop.BrowserParams.Add;
wRegion1.JQDragOptions.OnStop.BrowserParams.Items[0].ServerName := 'wRegion1';
wRegion1.JQDragOptions.OnStop.BrowserParams.Items[0].SendJSon := True;
wRegion1.JQDragOptions.OnStop.BrowserParams.Items[0].BrowserScript :=
//Definitely this is not best JQ code. But conception is visible.
'{Left: $("#WREGION1").css("left"), Top: $("#WREGION1").css("top"), ' +
'Height: $("#WREGION1").css("height"), Width: $("#WREGION1").css("width")}';
end;

procedure TwForm1.wRegion1JQDragOptionsStop(Sender: TObject; AParams: TStringList);
var
wRegionJsonObj: ISuperObject;
cssVal : string;
begin
CGCallBackDisableAjaxResponse();
try
wRegionJsonObj := SO(AParams.Values['wRegion1']);
cssVal := wRegionJsonObj.S['Left'];
wRegion1.Left := copy(cssVal, 1, cssVal.Length - 2 {delete "px"}).ToInteger;
cssVal := wRegionJsonObj.S['Top'];
wRegion1.Top := copy(cssVal, 1, cssVal.Length - 2 {delete "px"}).ToInteger;
cssVal := wRegionJsonObj.S['Width'];
wRegion1.Width := copy(cssVal, 1, cssVal.Length - 2 {delete "px"}).ToInteger + 2 {borders};
cssVal := wRegionJsonObj.S['Height'];
wRegion1.Height := copy(cssVal, 1, cssVal.Length - 2 {delete "px"}).ToInteger + 2 {borders};
finally
CGCallBackEnableAjaxResponse();
end;
end;
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by George » 13 Nov 2013 18:43

Hi!

Do you have you plans, to add JQResizeOptions ajax code? (for regions)
I've got message like that:
<Ajax event "JQResizeOptions.OnStop" not found>.

delphi code
wRegion.JQResizeOptions.Disabled := false;
wRegion.JQResizeOptions.OnStop.OnEvent := wRegion1JQResizeOptionsStop;
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 13 Nov 2013 18:52

Hello

Nice code

That's because JQResizeOptions is not published

We will publish that property, no warm will be done

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

by George » 13 Nov 2013 19:05

Ok.

Another thing with same direction:
IWCGJQDialogEx.JQDialogOptions.OnResize.Arguments have two arguments: "event, ui".
In IWCGJQDialogEx OnResize ajax event works.

So i set IWCGJQDialogEx.JQDialogOptions.OnResize.SendAllArguments := true to send ui object data to the server.
"ui" and "event" came to server as simple string without any usefull data ('ui=[object Object]', nil).
This is the correct behavior? And this is best place to send client size parameters :)
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 13 Nov 2013 19:09

Hi

SendAllArguments = True, by default, doesn't send in json format, that's the reason for the text '[object Object]'

to send in json format you must use a BrowserParam specifically

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

by George » 13 Nov 2013 19:14

When i write browser param script, i haven't context of the js object? (IWCGJQDialogEx for example)
Browser param script executes with global page context?
(i ask, because i want send UI object without dom traversing)

Yes, i have context :)
So i can simply write as browser script "ui".
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 13 Nov 2013 19:35

Hi

what you mean by context of the js object?

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

Next

Return to JQRegion

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.