RE: Need suggestion and evaluation

new topic     » topic index » view thread      » older message » newer message

> -----Original Message-----
> From: Frank [mailto:sekret7 at hotmail.com]

> I made my first program.
> Now I wish that you experts to evaluate it, give some tips,advice,...
> how to make it simplier or easyier to write and beter to work.

Congratulations, it looks pretty good!
 
> I have problem with setting cursor to "Sle1" control.
> When I input text at "Sle1" control, confirm with pushbutton "Add",
> I would like that cursor is automaticaly set in "Sle1" control.
> That way I would pass the annoying mouse clicking every time I wish
> to type some text (or any data) to "Sle1" control.

Try adding setFocus(list1) to the add event routine.
 
> The other problem is, when I enlarge the window, it becomes funny.
> Every control, buttons is in top left corner not in the middle of
> window. I do not know how to solve the problem.

This one is a little more complicated.  Take a look at the documentation for
create.  It explains how to use coordinates other than constants to position
controls.
Let's take a look at your add button:

add = create( PushButton, "Add Data", win, 300,  40, 100, 20, 0 )

The (x,y) values are (300,40).  But what you really want (I think) is to
have the position centered in the window.  Since the button is 100 wide, it
should be positioned 50 to the left of center:

add = create( PushButton, "Add Data", win, {.5,-50},  40, 100, 20, 0 )

Notice how we've changed the x value.  What it tells us is, "Start 50%
across the window, and subtract 50 from that."  So far, so good.  But what
about when the user resizes the window?  Now you need to use an onSize
event:

procedure win_size( integer style, integer x, integer y )
    setRect( add, {.5.-50}, 40, 100, 20, 1)
end procedure
onResize[Win] = routine_id("win_size")

Of course, you'll want to make the same changes to the rest of your
controls, but this is the basic idea.

Matt Lewis

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu