How to se focus and stay in second window?
Moderator: Rathinagiri
How to se focus and stay in second window?
Hi guys!
I'm working on my billing project.
I want to create one window with new invoice and call second window with grid with table of goodies to sell.
I'm using something like that:
activate window F_Invoice, F_TableOfGoodies
to acitvate both windows.
F_TableOfGoodies is hidden from definition.
after pressing F6 key, I'm trying to move focus to F_TableOfGoodies:
F_TableOfGoodies.Show
F_TableOfGoodies.SetFocus
after these commands, form F_TableOfGoodies appear, but immediately losts focus.
So, my question is:
How to stop focus in F_TableOfGoodies to let the operator select position from table of goodies?
Did sb. realised such a problem?
Best regards, Marek
I'm working on my billing project.
I want to create one window with new invoice and call second window with grid with table of goodies to sell.
I'm using something like that:
activate window F_Invoice, F_TableOfGoodies
to acitvate both windows.
F_TableOfGoodies is hidden from definition.
after pressing F6 key, I'm trying to move focus to F_TableOfGoodies:
F_TableOfGoodies.Show
F_TableOfGoodies.SetFocus
after these commands, form F_TableOfGoodies appear, but immediately losts focus.
So, my question is:
How to stop focus in F_TableOfGoodies to let the operator select position from table of goodies?
Did sb. realised such a problem?
Best regards, Marek
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to se focus and stay in second window?
Marek,
Can you please post a small sample?
Can you please post a small sample?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to se focus and stay in second window?
It's hard to prepare sample because this project is very huge now.
I'll try to describe it:
1. Form Invoice appears on screen
2. Operator presses "Add Position" Button
3. Form Table_Of_Goodies appears on screen
4. Operator selects position from table and double clicks on it.
5. Form Table_Of_Goodies disappears from screen
6. Selected article is added to Invoice
Ive realised it by creating Table_of_Goodies everytime, when operator clicks "add" button.
But it takes too much time in network environment (I don't know why).
So, I want to hide this window, not release it.
Marek
I'll try to describe it:
1. Form Invoice appears on screen
2. Operator presses "Add Position" Button
3. Form Table_Of_Goodies appears on screen
4. Operator selects position from table and double clicks on it.
5. Form Table_Of_Goodies disappears from screen
6. Selected article is added to Invoice
Ive realised it by creating Table_of_Goodies everytime, when operator clicks "add" button.
But it takes too much time in network environment (I don't know why).
So, I want to hide this window, not release it.
Marek
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to se focus and stay in second window?
Hi Marek,
Kindly see this small sample prepared by me. Is this what you need?
Kindly see this small sample prepared by me. Is this what you need?
Code: Select all
#include <hmg.ch>
Function Main
private cTarget := ''
define window inv at 0, 0 width 600 height 400 main
define label name1
row 10
col 10
width 50
value 'Item 1'
end label
define textbox item1
row 10
col 60
width 100
value ''
end textbox
define button b1
row 10
col 170
width 80
caption 'Add'
action selectitem( 'item1' )
end button
define label name2
row 40
col 10
width 50
value 'Item 1'
end label
define textbox item2
row 40
col 60
width 100
value ''
end textbox
define button b2
row 40
col 170
width 80
caption 'Add'
action selectitem( 'item2' )
end button
end window
define window items at 0, 0 width 200 height 300 child noshow
define listbox itemlist
row 10
col 10
width 180
height 240
items { 'Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6' }
ondblclick itemselected()
value 1
end listbox
end window
inv.center
items.center
activate window inv, items
Return
function selectitem( cTargetControl )
cTarget := cTargetControl
items.show
return nil
function itemselected
setproperty( 'inv', cTarget, 'VALUE', items.itemlist.item( items.itemlist.value ) )
items.hide
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to se focus and stay in second window?
Hi Rathi!
I've modified a little your sample to fit it to my situation, where INV form is called from MainWindow.
And then, something is going wrong:
I've modified a little your sample to fit it to my situation, where INV form is called from MainWindow.
And then, something is going wrong:
Code: Select all
#include <hmg.ch>
Function Main
private cTarget := ''
define window MainWindow at 0, 0 width 600 height 400 main title "Testing program"
define label name1
row 10
col 10
width 200
value 'Here is main window'
end label
define button b1
row 40
col 170
width 80
caption 'Start test'
action Start_test()
end button
end window
MainWindow.center
MainWindow.activate
return
function Start_Test
define window inv at 0, 0 width 600 height 400 title "Invoice" modal
define label name1
row 10
col 10
width 50
value 'Item 1'
end label
define textbox item1
row 10
col 60
width 100
value ''
end textbox
define button b1
row 10
col 170
width 80
caption 'Add'
action selectitem( 'item1' )
end button
define label name2
row 40
col 10
width 50
value 'Item 1'
end label
define textbox item2
row 40
col 60
width 100
value ''
end textbox
define button b2
row 40
col 170
width 80
caption 'Add'
action selectitem( 'item2' )
end button
end window
define window items at 0, 0 width 200 height 300 title "Items" child noshow
define listbox itemlist
row 10
col 10
width 180
height 240
items { 'Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6' }
ondblclick itemselected()
value 1
end listbox
end window
inv.center
items.center
activate window inv, items
Return
function selectitem( cTargetControl )
cTarget := cTargetControl
items.show
return nil
function itemselected
setproperty( 'inv', cTarget, 'VALUE', items.itemlist.item( items.itemlist.value ) )
items.hide
return nil
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to se focus and stay in second window?
It is because of the 'modal' type of window definition.
So, either change 'inv' to 'child' or 'items' to 'modal' and try again.
So, either change 'inv' to 'child' or 'items' to 'modal' and try again.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to se focus and stay in second window?
I've tried with both modal windows and it doesn't work OK.
I can't use child window, because child window is not blocking main window.
I'll make some tests later.
Thanks, Rathi!
I can't use child window, because child window is not blocking main window.
I'll make some tests later.
Thanks, Rathi!
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to se focus and stay in second window?
For me, at least for this sample, it works by making both the windows as modal.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to se focus and stay in second window?
Yes. I have changed like the below:
Code: Select all
#include <hmg.ch>
Function Main
private cTarget := ''
define window MainWindow at 0, 0 width 600 height 400 main title "Testing program"
define label name1
row 10
col 10
width 200
value 'Here is main window'
end label
define button b1
row 40
col 170
width 80
caption 'Start test'
action Start_test()
end button
end window
MainWindow.center
MainWindow.activate
return
function Start_Test
define window inv at 0, 0 width 600 height 400 title "Invoice" modal
define label name1
row 10
col 10
width 50
value 'Item 1'
end label
define textbox item1
row 10
col 60
width 100
value ''
end textbox
define button b1
row 10
col 170
width 80
caption 'Add'
action selectitem( 'item1' )
end button
define label name2
row 40
col 10
width 50
value 'Item 1'
end label
define textbox item2
row 40
col 60
width 100
value ''
end textbox
define button b2
row 40
col 170
width 80
caption 'Add'
action selectitem( 'item2' )
end button
end window
define window items at 0, 0 width 200 height 300 title "Items" modal noshow
define listbox itemlist
row 10
col 10
width 180
height 240
items { 'Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6' }
ondblclick itemselected()
value 1
end listbox
end window
inv.center
items.center
activate window inv, items
Return
function selectitem( cTargetControl )
cTarget := cTargetControl
items.show
return nil
function itemselected
setproperty( 'inv', cTarget, 'VALUE', items.itemlist.item( items.itemlist.value ) )
items.hide
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.