It can be so easy to take verses in the Bible out of context and to only focus on one part of what the verse is saying- usually the part that benefits us most.
Looking at Psalm 37:4 "Delight yourself in the LORD, and he will give you the desires of your heart." we can easily interpret it to mean that God will give us whatever we want as long as we follow His ways. It is important though that we look at the previous verses to see the context of the verse.
"Fret not yourself because of evildoers; be not envious of wrongdoers! For they will soon fade like the grass and wither like the green herb. Trust in the LORD, and do good; dwell in the land and befriend faithfulness." Psalm 37:1-3
In the first three verses, David is saying not to be envious of those who do wrong. That even though, they look like they are doing so well for themselves, that earthly wealth and fame will fade. They are trusting in material things and themselves, but we are to trust in the LORD and continue to do good and be faithful. Let's look at verse 4 again.
"Delight yourself in the LORD, and he will give you the desires of your heart." Psalm 37:4
What does it mean to delight in the LORD? To delight in the Lord means to be happy in all that He is and all that He has done for us. While the people who only care about themselves are delighting in material possessions, we are to delight in our God and His wonderful acts of goodness!
Delighting in Him and receiving what we desire is not only a cause and effect, like be nice to others and they will be nice to you, which doesn't always happen anyway. But, when we delight in the LORD, it is only natural that our heart's desires would begin to align with His will. When we want nothing but God's will to be done, it aligns us with His perfect will and prepares us for what He is doing in our lives. Are you delighting in the LORD or things that will fade away?