How do i develop GUI? 
Author Message
 How do i develop GUI?

try to use objects type declares..
for example:

type
    pWindow    = ^tWindow;
    tWindow = Object
            constructor    Init;
            Destructor    Done;
            Procedure    Proc1;
            Procedure    Proc2Sharable; Virtual;
    end;

Constructor tWindow.Init;
begin
end;

Procedure tWindow.Proc1;
begin
end;

Procedure tWindow.Proc2Sharable;
begin
end;

More info you can find in the online help of Borland/Turbo Pascal
doing at this method.. you can do alot of stuff easyer..

when you make an object or application loop.. you can use Pointers to handle
the multiple windows

windows: array [1..100] of pWindow; {for handling up to 100 windows at a
time}

Procedure AddWindow (Window: pWindow);
var
 cnt: integer;

begin
 for cnt:=1 to 100 do
 if Windows[cnt] = nil then begin
  windows[cnt]:=Window;
 exit;
end;
end;

Procedure    ProcessAllWindows;
var
 cnt: integer;

begin
 for cnt:=1 to 100 do
   if windows[cnt] <> nil then windows[cnt]^.proc1;
end;

if you know Pascal a bit.. you'll see the handyness of programming this way.
because you can create different objects this way by making objects that are
a descendant of the
pWindow..

for example:

type
  pWindowDescendant = ^tWindowDescendant;
  tWindowDescendant = Object (tWindow)
        Procedure    Proc2Sharable; Virtual;
  end;

Procedure tWindowDescendant.Proc2Sharable;
begin
 writeln ('This is something really really cool');
 { we can also inherited the old code, like this }
  Inherited Proc2Sharable; {executes code in tWindow.Proc2Sharable}
end;

you can add this window using the addwindow proc.. without getting errors.

var
 awindow: pWindow;
 bwindow: pWindowDescendant;

begin
 New (aWindow, Init);
 New (bWindow, Init);
 addWindow (aWindow);
 addWindow (bWindow);
 repeat
    ProcessAllWindows;
  until keypressed;
 dispose (aWindow, Done);
 dispose (bWindow, Done);
end;

Peter Santing,



Quote:
> I am working on a program right now but allthough it is working  properly,
> it has a crude environment.  Can someone help me in creating a nice
> interface where i could possibly move a highlight between options by
> pressing tab?
> thanks

> Neek



Wed, 18 Jun 1902 08:00:00 GMT  
 How do i develop GUI?

Quote:

> I am working on a program right now but allthough it is working  properly,
> it has a crude environment.  Can someone help me in creating a nice
> interface where i could possibly move a highlight between options by
> pressing tab?

You could use Turbo Vision if you have version 7.0 (or 6.0?). Otherwise, you
need to create everything yourself.

Create a unit that contains several procedures that carry out basic
operations: drawing a window, saving the screen and restoring it, drawing a
message box, waiting until a mouse button is pressed etc.



Wed, 18 Jun 1902 08:00:00 GMT  
 How do i develop GUI?
I am working on a program right now but allthough it is working  properly,
it has a crude environment.  Can someone help me in creating a nice
interface where i could possibly move a highlight between options by
pressing tab?
thanks

Neek



Wed, 18 Jun 1902 08:00:00 GMT  
 How do i develop GUI?

Quote:

>I am working on a program right now but allthough it is working  properly,
>it has a crude environment.  Can someone help me in creating a nice
>interface where i could possibly move a highlight between options by
>pressing tab?
>thanks

>Neek

What you like to be done kan be a pretty complicated job
depending on how you like to do it.
GUI?
If you like it to be done in Graphix it could be even more complicated.
Let's see if you like windows and objects like in windows.
I strongly suggest object orientation.
But it is possible to write a much simpler thing in procedure code.

You should probably make a unit or something.
Do not try to insert all these stuff into you program.

The part about moving with tab:
  have all the objects on the screen in an array.
  Then when TAB is pressed go to the next one.
  The higlighting is simply a change of text background.
Chaou
Heinrich

http://www.crosswinds.net/~jhdutoit/
Have a great TP tutorial!



Wed, 18 Jun 1902 08:00:00 GMT  
 How do i develop GUI?
Quote:

>I am working on a program right now but allthough it is working  properly,
>it has a crude environment.  Can someone help me in creating a nice
>interface where i could possibly move a highlight between options by
>pressing tab?

>I am working on a program right now but allthough it is working  properly,
>it has a crude environment.  Can someone help me in creating a nice
>interface where i could possibly move a highlight between options by
>pressing tab?



Wed, 18 Jun 1902 08:00:00 GMT  
 How do i develop GUI?
Quote:

> I am working on a program right now but allthough it is working  properly,
> it has a crude environment.  Can someone help me in creating a nice
> interface where i could possibly move a highlight between options by
> pressing tab?
> thanks

> Neek

Hi !

I have made several GUI's on PC and VMS platforms, and it is hell
of a job, if you wanna have complex one. First of all, you must
put down on the paper, what excatly do you want your GUI will offer
you. Then use modular approach, from lowest function (like conversion
from string to numeric and back, etc..) to highest (like create OK
window with some text delimited lines by ;).

But if you want just function which has few options to show, and
you can toggle between them, then you can use very simple approach.
Here I can give you hints from my head:

"Options" is a string, which has options delimited by a delimiter
(e.g.;)

Function GetOption(Options:String;StartX,StartY:Byte):Byte;
Begin
   parse options into array
   save screen at where options will reside
   display all options starting at StartX,StartY coordinates
   active = 1
   repeat
      show active reversed
      get key
      show active normal as others      
      case key of
        <TAB> : if active > 1 then dec(active);
  <shift TAB> : if active < maxtopicsinarray then inc(active);
         <ESC>: Begin
                   GetOption:=0;
                   Break ;
                End ;
       <ENTER>: Begin
                   GetOption:=active;
                   Break ;
                End ;
   until false ;
   restore saved screen back
End ;  

Alex
http://www.zag.si/~romaniuk/index.html



Wed, 18 Jun 1902 08:00:00 GMT  
 How do i develop GUI?
Well its just a simple menu of 4 or 5 choices from which the user presses
tab to switch between them and enter to enable his choise.  I never managed
to grab the meaning of arrays and programming.  How do i assign say A, B, C,
D to an array and then how can i move around them with tab while the text is
highlighted?  Sorry if those questions are dumb but i am a hardware person
with a personal hate towards programming.

Thanks in advance

Neek

Quote:


> > I am working on a program right now but allthough it is working
properly,
> > it has a crude environment.  Can someone help me in creating a nice
> > interface where i could possibly move a highlight between options by
> > pressing tab?
> > thanks

> > Neek
> Hi !

> I have made several GUI's on PC and VMS platforms, and it is hell
> of a job, if you wanna have complex one. First of all, you must
> put down on the paper, what excatly do you want your GUI will offer
> you. Then use modular approach, from lowest function (like conversion
> from string to numeric and back, etc..) to highest (like create OK
> window with some text delimited lines by ;).

> But if you want just function which has few options to show, and
> you can toggle between them, then you can use very simple approach.
> Here I can give you hints from my head:

> "Options" is a string, which has options delimited by a delimiter
> (e.g.;)

> Function GetOption(Options:String;StartX,StartY:Byte):Byte;
> Begin
>    parse options into array
>    save screen at where options will reside
>    display all options starting at StartX,StartY coordinates
>    active = 1
>    repeat
>       show active reversed
>       get key
>       show active normal as others
>       case key of
>         <TAB> : if active > 1 then dec(active);
>   <shift TAB> : if active < maxtopicsinarray then inc(active);
>          <ESC>: Begin
>                    GetOption:=0;
>                    Break ;
>                 End ;
>        <ENTER>: Begin
>                    GetOption:=active;
>                    Break ;
>                 End ;
>    until false ;
>    restore saved screen back
> End ;

> Alex
> http://www.zag.si/~romaniuk/index.html



Wed, 18 Jun 1902 08:00:00 GMT  
 How do i develop GUI?

Quote:

> Well its just a simple menu of 4 or 5 choices from which the user presses
> tab to switch between them and enter to enable his choise.  I never managed
> to grab the meaning of arrays and programming.  How do i assign say A, B, C,
> D to an array and then how can i move around them with tab while the text is
> highlighted?  Sorry if those questions are dumb but i am a hardware person
> with a personal hate towards programming.

> Thanks in advance

> Neek

Ok. Here it is. (Without screen saving)

Uses
   Crt ;
Const
   MaxOptions=10 ;
Type
   OptionType=String[ 20 ] ;
   OptionsType=Array [1..MaxOptions] Of OptionType ;

(*End up Options with NULL string*)
Function GetOption( Options: OptionsType; StartX,StartY:Byte):Byte ;
Var
   LastOption : Byte ;
   Active     : Byte ;
   X,Y        : Byte ;
   Ch         : Char ;
   Ok         : Boolean ;

   Procedure
DrawOption(Option:OptionType;X,Y,Foreground,Background:Byte);
   Var
      SaveAttr : Byte ;
   Begin
      SaveAttr := TextAttr ;
      GotoXY(X,Y);
      TextColor(Foreground);
      TextBackground(Background);
      Write(Option);
      TextAttr := SaveAttr ;
   End ;

Begin
   LastOption := 0 ;
   Active     := 1 ;
   X          := StartX ;
   Y          := StartY ;

   While (Active <= MaxOptions) and (Options[Active] <> '') do
   Begin
      DrawOption( Options[ Active ], X, Y, Blue, Black ) ;
      Inc(X, Length(Options[ Active ]) + 2) ;
      LastOption := Active ;
      Inc(Active);
   End ;

   X         := StartX ;
   Y         := StartY ;
   GetOption := 0 ;
   Active    := 1 ;
   Ok        := True ;
   While Ok do
   Begin
      DrawOption( Options[ Active ], X, Y, Yellow, Blue ) ;
      Ch := ReadKey ;
      DrawOption( Options[ Active ], X, Y, Blue, Black ) ;
      Case Ch of
         #0 : Case Readkey of
                 #15 : If Active > 1 Then  (* Shift-TAB *)
                       Begin
                          Dec(Active);
                          Dec(X, Length(Options[ Active ]) + 2);
                       End ;
              End ;
         #9 : If Active < LastOption Then
              Begin
                 Inc(X, Length(Options[ Active ]) + 2);
                 Inc(Active) ;
              End ;
         #13: Begin
                 GetOption := Active ;
                 Ok := False ;
              End ;
         #27: Begin
                 Ok := False ;
              End ;
      End ;
   End ;
End ;

Var
   MyOption : OptionsType ;
   O        : Byte ;

Begin
   MyOption[ 1 ] := '  Ok  ' ;
   MyOption[ 2 ] := ' Retry ' ;
   MyOption[ 3 ] := ' Cancel ' ;
   MyOption[ 4 ] := '';
   ClrScr ;
   O := GetOption(MyOption,5,5);
   ClrScr ;
   Writeln('Result:',O);
End.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Develop 16/32bit on same PC - HOW ?

2. Opening database (developed by Delphi) in MS Access

3. tool for developing a C/S application

4. Windows 3.1 software developed on windows 95

5. client/server develop.

6. Please recommend an approach to developing scalable database applications

7. Developing seamless applications to access local and remote SQL Oracle

8. READ IF DEVELOPING GFX UNIT

9. Developing general purpose database program

10. Developing DCOM Applications?

11. Develop a new OS!!

12. Developing Web Applications in Delphi

 

 
Powered by phpBB® Forum Software