Home » Developer & Programmer » Forms » forms 6i (no of records displayed)
forms 6i [message #358383] Tue, 11 November 2008 01:25 Go to next message
spmano1983
Messages: 269
Registered: September 2007
Senior Member
how to set the no of records displayed property dynamically?

thanks
Re: forms 6i [message #358390 is a reply to message #358383] Tue, 11 November 2008 01:36 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It can not be set; not by using available SET_..._PROPERTY built-ins.

There are workarounds, though, but much too ugly to bother (such as creating a block which consists of "many" blocks, each of them representing one record, so you'd have to suffer from coding how to manipulate data (query, insert, update) in such a design; or, you might create "normal" block and a stacked canvas which you'd shrink or expand, depending on number of actual records, so that this stacked canvas covers "empty" records).

I wouldn't bother, really.
Re: forms 6i [message #358467 is a reply to message #358390] Tue, 11 November 2008 08:51 Go to previous message
saadatahmad
Messages: 452
Registered: March 2005
Location: Germany/Paderborn
Senior Member

hi,
It's not a good idea to implement this functionality on production systems, and Littlefoot wouldn't bother either Smile

One solution which Littlefoot suggested can be implemented like this.

Create a multi record (show 25 records) form for emp table (for all columns).
create a stack canvas.
Write the following trigger on Post-Query
--		40 	= First Item's Y-Position on the canvas
--		14 	= Height of Items
--		empno	= First Item on the Canvas
--		deptno	= Last Item on the Canvas
--		scanv	= Stack Canvas
declare	
	RecordsDisplayed	number;
	CountHits					number;
	View_X_Pos				number;
	View_Y_Pos				number;
	View_Width				number;
	View_Height				number;
begin
	RecordsDisplayed := Get_Block_Property('emp',records_displayed);
	CountHits := Get_Block_Property('emp',query_hits);
	
	if get_view_property('scanv', visible) = 'true' then
		set_view_property('scanv', visible, property_false);
	end if;

	if CountHits <= RecordsDisplayed then
		View_X_Pos := get_item_property('emp.empno', x_pos);
		View_Y_Pos := 40 + CountHits * 14;
		View_Width := get_item_property('deptno', x_pos)
                            + get_item_property('deptno', width)
                            - get_item_property('empno', x_pos);
		View_Height := (RecordsDisplayed - CountHits) * 14;
	  set_view_property('scanv', display_position, View_X_Pos, View_Y_Pos);

  	set_view_property('scanv', Height,View_Height);
  	set_view_property('scanv', width, View_Width);
	  set_view_property('scanv', visible, property_true);
	end if;	
end;	

Run the form and enjoy.
BTW : What will happen if there is a scroll bar!!!!!
If that is the case, fix it yourself Smile

regards,
Saadat Ahmad
[EDITED by DJM: split long line]

[Updated on: Tue, 11 November 2008 19:06] by Moderator

Report message to a moderator

Previous Topic: clear_block(no_validate)
Next Topic: what is the sql menu tool ?
Goto Forum:
  


Current Time: Sun Dec 08 06:29:01 CST 2024