FAQ FAQ  Forum Search   Register Register  Login Login

Re-order blocks on forms?

 Post Reply Post Reply
Author
fblindhe View Drop Down
Newbie
Newbie


Joined: 26-January-2010
Posts: 2
Post Options Post Options   Quote fblindhe Quote  Post ReplyReply Direct Link To This Post Topic: Re-order blocks on forms?
    Posted: 26-January-2010 at 12:02pm

We added a new block to an object group that is used by all of our forms.  When we open one of the forms in Developer, and it inherits the new block, the block is first block in the list.  We need it to be at the bottom.

Is it possible to write a FormsAPI Master script to re-order the blocks on a form so the new inherited block is the last block in the list?

Back to Top
administrator View Drop Down
Admin Group
Admin Group

Stefan Mueller

Joined: 25-January-2003
Location: Japan
Posts: 750
Post Options Post Options   Quote administrator Quote  Post ReplyReply Direct Link To This Post Posted: 26-January-2010 at 9:28pm
Yes, that is no problem - check the helpfiles for a function called "Generic_Move()".



DECLARE
frm   number;
blk   number;

BEGIN
frm := Form_Load(C_FAPIMASTERDIR+'test.fmb');

blk := Generic_GetObjProp(frm, D2FP_BLOCK);
while blk <> 0 do
begin
    LogAdd( Generic_GetTextProp(blk, D2FP_NAME) );
    blk := Generic_GetObjProp(blk, D2FP_NEXT);
end;

LogAdd('** move block10 to the end **');
--using "0" as next object parameter in generic_move
-- will move it to the end.
blk := Generic_FindObj(frm, 'BLOCK10', D2FFO_BLOCK);
generic_move(blk, 0);

blk := Generic_GetObjProp(frm, D2FP_BLOCK);
while blk <> 0 do
begin
    LogAdd( Generic_GetTextProp(blk, D2FP_NAME) );
    blk := Generic_GetObjProp(blk, D2FP_NEXT);
end;

//free the form from memory
Form_Destroy(frm);
END.




output:
14:25:15 [Info]    Running script <noname.p2s>
14:25:15           BLOCK10
14:25:15           BLOCK11
14:25:15           BLOCK2
14:25:15           ** move block10 to the end **
14:25:15           BLOCK11
14:25:15           BLOCK2
14:25:15           BLOCK10
14:25:15 [Info]    Script execution finished

Back to Top
fblindhe View Drop Down
Newbie
Newbie


Joined: 26-January-2010
Posts: 2
Post Options Post Options   Quote fblindhe Quote  Post ReplyReply Direct Link To This Post Posted: 27-January-2010 at 7:30am
Thank you very much, Stefan.  That is exactly what I was looking for.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.66 [Free Express Edition]
Copyright ©2001-2010 Web Wiz