~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to packages/extra/forms/demo/fbrowse1.pp

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{ This demo shows the use of a browser and fl_call_object_callback.  }
 
2
program fbrowse1;
 
3
 
 
4
uses xforms;
 
5
 
 
6
var
 
7
  form : PFL_FORM;
 
8
  br, but : PFL_OBJECT;
 
9
 
 
10
procedure load_file(ob : PFL_OBJECT; arg : longint);export;
 
11
 
 
12
begin
 
13
  if (fl_load_browser(br,fl_show_input('Filename to load',''))<>0) then
 
14
     fl_add_browser_line(br,'NO SUCH FILE!');
 
15
end;
 
16
 
 
17
procedure set_size(ob : PFL_OBJECT; arg : Longint);export;
 
18
 
 
19
begin
 
20
  fl_set_browser_fontsize(br, arg);
 
21
end;
 
22
 
 
23
 
 
24
var obj : PFL_OBJECT;
 
25
 
 
26
begin
 
27
    fl_initialize(@argc, argv, 'FormDemo', nil, 0);
 
28
 
 
29
    form := fl_bgn_form(FL_UP_BOX,130,100);
 
30
     br := fl_add_browser(FL_NORMAL_BROWSER,5,5,95,90,'');
 
31
     but := fl_add_button(FL_NORMAL_BUTTON,105,5,20,8,'Exit');
 
32
     obj := fl_add_button(FL_NORMAL_BUTTON,105,75,20,8,'Load');
 
33
     fl_set_object_callback(obj,PFL_CALLBACKPTR(@load_file),0);
 
34
     obj := fl_add_lightbutton(FL_RADIO_BUTTON,105,60,20,8,'Small');
 
35
     fl_set_object_callback(obj,PFL_CALLBACKPTR(@set_size),FL_SMALL_SIZE);
 
36
     fl_call_object_callback(obj);
 
37
     fl_set_button(obj,1);
 
38
     obj := fl_add_lightbutton(FL_RADIO_BUTTON,105,50,20,8,'Normal');
 
39
     fl_set_object_callback(obj,PFL_CALLBACKPTR(@set_size),FL_NORMAL_SIZE);
 
40
     obj := fl_add_lightbutton(FL_RADIO_BUTTON,105,40,20,8,'Large');
 
41
     fl_set_object_callback(obj,PFL_CALLBACKPTR(@set_size),FL_LARGE_SIZE);
 
42
    fl_end_form();
 
43
 
 
44
  fl_clear_browser(br);
 
45
  fl_add_browser_line(br,'LOAD A FILE.');
 
46
  fl_scale_form(form, 4.0, 4.0);
 
47
 
 
48
  fl_show_form(form,FL_PLACE_FREE,FL_FULLBORDER,'Browser');
 
49
 
 
50
  repeat
 
51
    obj := fl_do_forms;
 
52
  until obj = but;
 
53
  fl_hide_form(form);
 
54
end.
 
55
{
 
56
  $Log: fbrowse1.pp,v $
 
57
  Revision 1.3  2003/10/27 15:48:13  peter
 
58
    * renamed forms unit to xforms to prevent conflict with Forms
 
59
      from the LCL
 
60
 
 
61
  Revision 1.2  2002/09/07 15:42:55  peter
 
62
    * old logs removed and tabs fixed
 
63
 
 
64
  Revision 1.1  2002/01/29 17:55:01  peter
 
65
    * splitted to base and extra
 
66
 
 
67
}