# Loading 'default values' from sqlite db to a second window

**URL:** <https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718>\
**Category:** Getting Started\
**Created:** [August 19, 2014, 6:01pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718 "2014-08-19T18:01:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex\_bartonek](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@alex\_bartonek](https://forum.xojo.com/u/alex_bartonek)\
**Post date:** [August 19, 2014, 6:01pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/1 "2014-08-19T18:01:16Z")

</div>

I’m loading “default values” of an app and populating a window called “defaults”. The “defaults” window isnt visible unless you click a button and it pops up with values. These default values are loaded when you first run the program. The problem is, if I move the main window, the “defaults” window is right behind it. I dont want that visible. If I click the “defaults” button, it pops it up, I click the “ok” button I have defined which has a self.close. Once that happens, if I click on “defaults” button again, the values are no longer there. How do I get it to retain values? Is it a matter of how I’m approaching it? Should I load it all the time from the db (doesnt sound very efficient)…

thoughts…

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [August 19, 2014, 7:13pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/2 "2014-08-19T19:13:23Z")

</div>

If the “Implicit Instance” property is ON for the window, it will automatically be shown when you reference it in any way. You could turn that off and then create a new instance manually as needed.

Regardless, I’d probably load the defaults into a class (or module) and then have the window fetch the values from their in its Open event handler rather than directly setting the values of a window from your database lookup code.

---

<div class="post-metadata">

**Author:** ![Richard\_Duke](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_duke/32/246_2.png) [@Richard\_Duke](https://forum.xojo.com/u/Richard_Duke)\
**Post date:** [August 19, 2014, 7:39pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/3 "2014-08-19T19:39:48Z")

</div>

or load it into a dictionary and referring to the dictionary when u need the value.

---

<div class="post-metadata">

**Author:** ![alex\_bartonek](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@alex\_bartonek](https://forum.xojo.com/u/alex_bartonek)\
**Post date:** [August 20, 2014, 1:52pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/4 "2014-08-20T13:52:27Z")

</div>

Paul,

If I disable that, then yes I have to come up with an alternative way to load “defaults” because if implicit isnt enabled, I cant pre-populate that window (error in my code).

When you say load defaults into a class or module…is there an example of that somewhere?

---

<div class="post-metadata">

**Author:** ![scott\_boss](https://forum.xojo.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@scott\_boss](https://forum.xojo.com/u/scott_boss)\
**Post date:** [August 20, 2014, 2:12pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/5 "2014-08-20T14:12:58Z")

</div>

Alex, create a module (call it something like globalProperties) and create a property in it for each of the “default” properties. Then reference them in the defaultWindow open event to populate the defaults.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [August 20, 2014, 3:46pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/6 "2014-08-20T15:46:05Z")

</div>

The quick and dirty solution it to set the defaults window’s Visible property to False in the IDE. But using a module/class/dictionary is a better solution.

---

<div class="post-metadata">

**Author:** ![alex\_bartonek](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@alex\_bartonek](https://forum.xojo.com/u/alex_bartonek)\
**Post date:** [August 21, 2014, 1:01pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/7 "2014-08-21T13:01:03Z")

</div>

Tim: aaahhh…that works perfectly. Thanks!!

Scott: ok…I am googling an example. Looks like that will work.

I appreciate you guys help!

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:22pm UTC](https://forum.xojo.com/t/loading-default-values-from-sqlite-db-to-a-second-window/18718/8 "2020-10-29T17:22:55Z")

</div>


